PK \FU U error_lognu [ [17-Feb-2024 00:01:01 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[17-Feb-2024 04:37:57 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[17-Feb-2024 06:15:51 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[31-Mar-2024 19:53:41 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[01-Apr-2024 16:12:17 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[29-Apr-2024 11:30:57 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[02-May-2024 20:44:57 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[06-May-2024 05:36:49 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[10-May-2024 18:26:51 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[11-May-2024 09:34:25 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[11-May-2024 16:17:37 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[26-Jun-2024 21:55:22 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[12-Jul-2024 17:02:22 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[18-Jul-2024 16:16:04 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[22-Jul-2024 19:54:18 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[29-Jul-2024 02:42:33 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[07-Aug-2024 05:11:55 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[07-Aug-2024 15:56:26 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[09-Aug-2024 06:49:52 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[09-Aug-2024 19:57:40 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[10-Aug-2024 02:41:26 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[10-Aug-2024 20:43:08 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[08-Sep-2024 21:02:42 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[19-Sep-2024 20:15:12 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[19-Sep-2024 20:30:24 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[10-Nov-2024 08:57:20 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[10-Nov-2024 11:35:30 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[13-Nov-2024 09:45:15 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[16-Nov-2024 04:23:32 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[17-Nov-2024 02:06:17 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
[19-Nov-2024 00:31:30 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php:53
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/Core.php on line 53
PK \.-- - library/SimplePie/Registry.phpnu [ E\S S library/SimplePie/Exception.phpnu [
*/
class SimplePie_HTTP_Parser extends Parser
{
}
}
PK \ library/SimplePie/HTTP/.htaccessnu [ PK \= library/SimplePie/File.phpnu [ - - library/SimplePie/gzdecode.phpnu [ data = $data;
}
/**
* Parse the input data
*
* @access public
* @return string Output data
*/
public function parse()
{
while (($position = strpos($this->data, '&', $this->position)) !== false) {
$this->position = $position;
$this->consume();
$this->entity();
$this->consumed = '';
}
return $this->data;
}
/**
* Consume the next byte
*
* @access private
* @return string|false The next byte, or false, if there is no more data
*/
public function consume()
{
if (isset($this->data[$this->position])) {
$this->consumed .= $this->data[$this->position];
return $this->data[$this->position++];
}
return false;
}
/**
* Consume a range of characters
*
* @access private
* @param string $chars Characters to consume
* @return string|false A series of characters that match the range, or false
*/
public function consume_range(string $chars)
{
if ($len = strspn($this->data, $chars, $this->position)) {
$data = substr($this->data, $this->position, $len);
$this->consumed .= $data;
$this->position += $len;
return $data;
}
return false;
}
/**
* Unconsume one byte
*
* @access private
* @return void
*/
public function unconsume()
{
$this->consumed = substr($this->consumed, 0, -1);
$this->position--;
}
/**
* Decode an entity
*
* @access private
* @return void
*/
public function entity()
{
switch ($this->consume()) {
case "\x09":
case "\x0A":
case "\x0B":
case "\x0C":
case "\x20":
case "\x3C":
case "\x26":
case false:
break;
case "\x23":
switch ($this->consume()) {
case "\x78":
case "\x58":
$range = '0123456789ABCDEFabcdef';
$hex = true;
break;
default:
$range = '0123456789';
$hex = false;
$this->unconsume();
break;
}
if ($codepoint = $this->consume_range($range)) {
static $windows_1252_specials = [0x0D => "\x0A", 0x80 => "\xE2\x82\xAC", 0x81 => "\xEF\xBF\xBD", 0x82 => "\xE2\x80\x9A", 0x83 => "\xC6\x92", 0x84 => "\xE2\x80\x9E", 0x85 => "\xE2\x80\xA6", 0x86 => "\xE2\x80\xA0", 0x87 => "\xE2\x80\xA1", 0x88 => "\xCB\x86", 0x89 => "\xE2\x80\xB0", 0x8A => "\xC5\xA0", 0x8B => "\xE2\x80\xB9", 0x8C => "\xC5\x92", 0x8D => "\xEF\xBF\xBD", 0x8E => "\xC5\xBD", 0x8F => "\xEF\xBF\xBD", 0x90 => "\xEF\xBF\xBD", 0x91 => "\xE2\x80\x98", 0x92 => "\xE2\x80\x99", 0x93 => "\xE2\x80\x9C", 0x94 => "\xE2\x80\x9D", 0x95 => "\xE2\x80\xA2", 0x96 => "\xE2\x80\x93", 0x97 => "\xE2\x80\x94", 0x98 => "\xCB\x9C", 0x99 => "\xE2\x84\xA2", 0x9A => "\xC5\xA1", 0x9B => "\xE2\x80\xBA", 0x9C => "\xC5\x93", 0x9D => "\xEF\xBF\xBD", 0x9E => "\xC5\xBE", 0x9F => "\xC5\xB8"];
if ($hex) {
// Cap to PHP_INT_MAX to ensure consistent behaviour if $codepoint is so large
// it cannot fit into int – just casting float to int might return junk (e.g. a negative number).
// If it is so large, `Misc::codepoint_to_utf8` will just return a replacement character.
$codepoint = (int) min(hexdec($codepoint), \PHP_INT_MAX);
} else {
// Casting string to int caps at PHP_INT_MAX automatically.
$codepoint = (int) $codepoint;
}
if (isset($windows_1252_specials[$codepoint])) {
$replacement = $windows_1252_specials[$codepoint];
} else {
$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
}
if (!in_array($this->consume(), [';', false], true)) {
$this->unconsume();
}
$consumed_length = strlen($this->consumed);
$this->data = substr_replace($this->data, $replacement, $this->position - $consumed_length, $consumed_length);
$this->position += strlen($replacement) - $consumed_length;
}
break;
default:
static $entities = [
'Aacute' => "\xC3\x81",
'aacute' => "\xC3\xA1",
'Aacute;' => "\xC3\x81",
'aacute;' => "\xC3\xA1",
'Acirc' => "\xC3\x82",
'acirc' => "\xC3\xA2",
'Acirc;' => "\xC3\x82",
'acirc;' => "\xC3\xA2",
'acute' => "\xC2\xB4",
'acute;' => "\xC2\xB4",
'AElig' => "\xC3\x86",
'aelig' => "\xC3\xA6",
'AElig;' => "\xC3\x86",
'aelig;' => "\xC3\xA6",
'Agrave' => "\xC3\x80",
'agrave' => "\xC3\xA0",
'Agrave;' => "\xC3\x80",
'agrave;' => "\xC3\xA0",
'alefsym;' => "\xE2\x84\xB5",
'Alpha;' => "\xCE\x91",
'alpha;' => "\xCE\xB1",
'AMP' => "\x26",
'amp' => "\x26",
'AMP;' => "\x26",
'amp;' => "\x26",
'and;' => "\xE2\x88\xA7",
'ang;' => "\xE2\x88\xA0",
'apos;' => "\x27",
'Aring' => "\xC3\x85",
'aring' => "\xC3\xA5",
'Aring;' => "\xC3\x85",
'aring;' => "\xC3\xA5",
'asymp;' => "\xE2\x89\x88",
'Atilde' => "\xC3\x83",
'atilde' => "\xC3\xA3",
'Atilde;' => "\xC3\x83",
'atilde;' => "\xC3\xA3",
'Auml' => "\xC3\x84",
'auml' => "\xC3\xA4",
'Auml;' => "\xC3\x84",
'auml;' => "\xC3\xA4",
'bdquo;' => "\xE2\x80\x9E",
'Beta;' => "\xCE\x92",
'beta;' => "\xCE\xB2",
'brvbar' => "\xC2\xA6",
'brvbar;' => "\xC2\xA6",
'bull;' => "\xE2\x80\xA2",
'cap;' => "\xE2\x88\xA9",
'Ccedil' => "\xC3\x87",
'ccedil' => "\xC3\xA7",
'Ccedil;' => "\xC3\x87",
'ccedil;' => "\xC3\xA7",
'cedil' => "\xC2\xB8",
'cedil;' => "\xC2\xB8",
'cent' => "\xC2\xA2",
'cent;' => "\xC2\xA2",
'Chi;' => "\xCE\xA7",
'chi;' => "\xCF\x87",
'circ;' => "\xCB\x86",
'clubs;' => "\xE2\x99\xA3",
'cong;' => "\xE2\x89\x85",
'COPY' => "\xC2\xA9",
'copy' => "\xC2\xA9",
'COPY;' => "\xC2\xA9",
'copy;' => "\xC2\xA9",
'crarr;' => "\xE2\x86\xB5",
'cup;' => "\xE2\x88\xAA",
'curren' => "\xC2\xA4",
'curren;' => "\xC2\xA4",
'Dagger;' => "\xE2\x80\xA1",
'dagger;' => "\xE2\x80\xA0",
'dArr;' => "\xE2\x87\x93",
'darr;' => "\xE2\x86\x93",
'deg' => "\xC2\xB0",
'deg;' => "\xC2\xB0",
'Delta;' => "\xCE\x94",
'delta;' => "\xCE\xB4",
'diams;' => "\xE2\x99\xA6",
'divide' => "\xC3\xB7",
'divide;' => "\xC3\xB7",
'Eacute' => "\xC3\x89",
'eacute' => "\xC3\xA9",
'Eacute;' => "\xC3\x89",
'eacute;' => "\xC3\xA9",
'Ecirc' => "\xC3\x8A",
'ecirc' => "\xC3\xAA",
'Ecirc;' => "\xC3\x8A",
'ecirc;' => "\xC3\xAA",
'Egrave' => "\xC3\x88",
'egrave' => "\xC3\xA8",
'Egrave;' => "\xC3\x88",
'egrave;' => "\xC3\xA8",
'empty;' => "\xE2\x88\x85",
'emsp;' => "\xE2\x80\x83",
'ensp;' => "\xE2\x80\x82",
'Epsilon;' => "\xCE\x95",
'epsilon;' => "\xCE\xB5",
'equiv;' => "\xE2\x89\xA1",
'Eta;' => "\xCE\x97",
'eta;' => "\xCE\xB7",
'ETH' => "\xC3\x90",
'eth' => "\xC3\xB0",
'ETH;' => "\xC3\x90",
'eth;' => "\xC3\xB0",
'Euml' => "\xC3\x8B",
'euml' => "\xC3\xAB",
'Euml;' => "\xC3\x8B",
'euml;' => "\xC3\xAB",
'euro;' => "\xE2\x82\xAC",
'exist;' => "\xE2\x88\x83",
'fnof;' => "\xC6\x92",
'forall;' => "\xE2\x88\x80",
'frac12' => "\xC2\xBD",
'frac12;' => "\xC2\xBD",
'frac14' => "\xC2\xBC",
'frac14;' => "\xC2\xBC",
'frac34' => "\xC2\xBE",
'frac34;' => "\xC2\xBE",
'frasl;' => "\xE2\x81\x84",
'Gamma;' => "\xCE\x93",
'gamma;' => "\xCE\xB3",
'ge;' => "\xE2\x89\xA5",
'GT' => "\x3E",
'gt' => "\x3E",
'GT;' => "\x3E",
'gt;' => "\x3E",
'hArr;' => "\xE2\x87\x94",
'harr;' => "\xE2\x86\x94",
'hearts;' => "\xE2\x99\xA5",
'hellip;' => "\xE2\x80\xA6",
'Iacute' => "\xC3\x8D",
'iacute' => "\xC3\xAD",
'Iacute;' => "\xC3\x8D",
'iacute;' => "\xC3\xAD",
'Icirc' => "\xC3\x8E",
'icirc' => "\xC3\xAE",
'Icirc;' => "\xC3\x8E",
'icirc;' => "\xC3\xAE",
'iexcl' => "\xC2\xA1",
'iexcl;' => "\xC2\xA1",
'Igrave' => "\xC3\x8C",
'igrave' => "\xC3\xAC",
'Igrave;' => "\xC3\x8C",
'igrave;' => "\xC3\xAC",
'image;' => "\xE2\x84\x91",
'infin;' => "\xE2\x88\x9E",
'int;' => "\xE2\x88\xAB",
'Iota;' => "\xCE\x99",
'iota;' => "\xCE\xB9",
'iquest' => "\xC2\xBF",
'iquest;' => "\xC2\xBF",
'isin;' => "\xE2\x88\x88",
'Iuml' => "\xC3\x8F",
'iuml' => "\xC3\xAF",
'Iuml;' => "\xC3\x8F",
'iuml;' => "\xC3\xAF",
'Kappa;' => "\xCE\x9A",
'kappa;' => "\xCE\xBA",
'Lambda;' => "\xCE\x9B",
'lambda;' => "\xCE\xBB",
'lang;' => "\xE3\x80\x88",
'laquo' => "\xC2\xAB",
'laquo;' => "\xC2\xAB",
'lArr;' => "\xE2\x87\x90",
'larr;' => "\xE2\x86\x90",
'lceil;' => "\xE2\x8C\x88",
'ldquo;' => "\xE2\x80\x9C",
'le;' => "\xE2\x89\xA4",
'lfloor;' => "\xE2\x8C\x8A",
'lowast;' => "\xE2\x88\x97",
'loz;' => "\xE2\x97\x8A",
'lrm;' => "\xE2\x80\x8E",
'lsaquo;' => "\xE2\x80\xB9",
'lsquo;' => "\xE2\x80\x98",
'LT' => "\x3C",
'lt' => "\x3C",
'LT;' => "\x3C",
'lt;' => "\x3C",
'macr' => "\xC2\xAF",
'macr;' => "\xC2\xAF",
'mdash;' => "\xE2\x80\x94",
'micro' => "\xC2\xB5",
'micro;' => "\xC2\xB5",
'middot' => "\xC2\xB7",
'middot;' => "\xC2\xB7",
'minus;' => "\xE2\x88\x92",
'Mu;' => "\xCE\x9C",
'mu;' => "\xCE\xBC",
'nabla;' => "\xE2\x88\x87",
'nbsp' => "\xC2\xA0",
'nbsp;' => "\xC2\xA0",
'ndash;' => "\xE2\x80\x93",
'ne;' => "\xE2\x89\xA0",
'ni;' => "\xE2\x88\x8B",
'not' => "\xC2\xAC",
'not;' => "\xC2\xAC",
'notin;' => "\xE2\x88\x89",
'nsub;' => "\xE2\x8A\x84",
'Ntilde' => "\xC3\x91",
'ntilde' => "\xC3\xB1",
'Ntilde;' => "\xC3\x91",
'ntilde;' => "\xC3\xB1",
'Nu;' => "\xCE\x9D",
'nu;' => "\xCE\xBD",
'Oacute' => "\xC3\x93",
'oacute' => "\xC3\xB3",
'Oacute;' => "\xC3\x93",
'oacute;' => "\xC3\xB3",
'Ocirc' => "\xC3\x94",
'ocirc' => "\xC3\xB4",
'Ocirc;' => "\xC3\x94",
'ocirc;' => "\xC3\xB4",
'OElig;' => "\xC5\x92",
'oelig;' => "\xC5\x93",
'Ograve' => "\xC3\x92",
'ograve' => "\xC3\xB2",
'Ograve;' => "\xC3\x92",
'ograve;' => "\xC3\xB2",
'oline;' => "\xE2\x80\xBE",
'Omega;' => "\xCE\xA9",
'omega;' => "\xCF\x89",
'Omicron;' => "\xCE\x9F",
'omicron;' => "\xCE\xBF",
'oplus;' => "\xE2\x8A\x95",
'or;' => "\xE2\x88\xA8",
'ordf' => "\xC2\xAA",
'ordf;' => "\xC2\xAA",
'ordm' => "\xC2\xBA",
'ordm;' => "\xC2\xBA",
'Oslash' => "\xC3\x98",
'oslash' => "\xC3\xB8",
'Oslash;' => "\xC3\x98",
'oslash;' => "\xC3\xB8",
'Otilde' => "\xC3\x95",
'otilde' => "\xC3\xB5",
'Otilde;' => "\xC3\x95",
'otilde;' => "\xC3\xB5",
'otimes;' => "\xE2\x8A\x97",
'Ouml' => "\xC3\x96",
'ouml' => "\xC3\xB6",
'Ouml;' => "\xC3\x96",
'ouml;' => "\xC3\xB6",
'para' => "\xC2\xB6",
'para;' => "\xC2\xB6",
'part;' => "\xE2\x88\x82",
'permil;' => "\xE2\x80\xB0",
'perp;' => "\xE2\x8A\xA5",
'Phi;' => "\xCE\xA6",
'phi;' => "\xCF\x86",
'Pi;' => "\xCE\xA0",
'pi;' => "\xCF\x80",
'piv;' => "\xCF\x96",
'plusmn' => "\xC2\xB1",
'plusmn;' => "\xC2\xB1",
'pound' => "\xC2\xA3",
'pound;' => "\xC2\xA3",
'Prime;' => "\xE2\x80\xB3",
'prime;' => "\xE2\x80\xB2",
'prod;' => "\xE2\x88\x8F",
'prop;' => "\xE2\x88\x9D",
'Psi;' => "\xCE\xA8",
'psi;' => "\xCF\x88",
'QUOT' => "\x22",
'quot' => "\x22",
'QUOT;' => "\x22",
'quot;' => "\x22",
'radic;' => "\xE2\x88\x9A",
'rang;' => "\xE3\x80\x89",
'raquo' => "\xC2\xBB",
'raquo;' => "\xC2\xBB",
'rArr;' => "\xE2\x87\x92",
'rarr;' => "\xE2\x86\x92",
'rceil;' => "\xE2\x8C\x89",
'rdquo;' => "\xE2\x80\x9D",
'real;' => "\xE2\x84\x9C",
'REG' => "\xC2\xAE",
'reg' => "\xC2\xAE",
'REG;' => "\xC2\xAE",
'reg;' => "\xC2\xAE",
'rfloor;' => "\xE2\x8C\x8B",
'Rho;' => "\xCE\xA1",
'rho;' => "\xCF\x81",
'rlm;' => "\xE2\x80\x8F",
'rsaquo;' => "\xE2\x80\xBA",
'rsquo;' => "\xE2\x80\x99",
'sbquo;' => "\xE2\x80\x9A",
'Scaron;' => "\xC5\xA0",
'scaron;' => "\xC5\xA1",
'sdot;' => "\xE2\x8B\x85",
'sect' => "\xC2\xA7",
'sect;' => "\xC2\xA7",
'shy' => "\xC2\xAD",
'shy;' => "\xC2\xAD",
'Sigma;' => "\xCE\xA3",
'sigma;' => "\xCF\x83",
'sigmaf;' => "\xCF\x82",
'sim;' => "\xE2\x88\xBC",
'spades;' => "\xE2\x99\xA0",
'sub;' => "\xE2\x8A\x82",
'sube;' => "\xE2\x8A\x86",
'sum;' => "\xE2\x88\x91",
'sup;' => "\xE2\x8A\x83",
'sup1' => "\xC2\xB9",
'sup1;' => "\xC2\xB9",
'sup2' => "\xC2\xB2",
'sup2;' => "\xC2\xB2",
'sup3' => "\xC2\xB3",
'sup3;' => "\xC2\xB3",
'supe;' => "\xE2\x8A\x87",
'szlig' => "\xC3\x9F",
'szlig;' => "\xC3\x9F",
'Tau;' => "\xCE\xA4",
'tau;' => "\xCF\x84",
'there4;' => "\xE2\x88\xB4",
'Theta;' => "\xCE\x98",
'theta;' => "\xCE\xB8",
'thetasym;' => "\xCF\x91",
'thinsp;' => "\xE2\x80\x89",
'THORN' => "\xC3\x9E",
'thorn' => "\xC3\xBE",
'THORN;' => "\xC3\x9E",
'thorn;' => "\xC3\xBE",
'tilde;' => "\xCB\x9C",
'times' => "\xC3\x97",
'times;' => "\xC3\x97",
'TRADE;' => "\xE2\x84\xA2",
'trade;' => "\xE2\x84\xA2",
'Uacute' => "\xC3\x9A",
'uacute' => "\xC3\xBA",
'Uacute;' => "\xC3\x9A",
'uacute;' => "\xC3\xBA",
'uArr;' => "\xE2\x87\x91",
'uarr;' => "\xE2\x86\x91",
'Ucirc' => "\xC3\x9B",
'ucirc' => "\xC3\xBB",
'Ucirc;' => "\xC3\x9B",
'ucirc;' => "\xC3\xBB",
'Ugrave' => "\xC3\x99",
'ugrave' => "\xC3\xB9",
'Ugrave;' => "\xC3\x99",
'ugrave;' => "\xC3\xB9",
'uml' => "\xC2\xA8",
'uml;' => "\xC2\xA8",
'upsih;' => "\xCF\x92",
'Upsilon;' => "\xCE\xA5",
'upsilon;' => "\xCF\x85",
'Uuml' => "\xC3\x9C",
'uuml' => "\xC3\xBC",
'Uuml;' => "\xC3\x9C",
'uuml;' => "\xC3\xBC",
'weierp;' => "\xE2\x84\x98",
'Xi;' => "\xCE\x9E",
'xi;' => "\xCE\xBE",
'Yacute' => "\xC3\x9D",
'yacute' => "\xC3\xBD",
'Yacute;' => "\xC3\x9D",
'yacute;' => "\xC3\xBD",
'yen' => "\xC2\xA5",
'yen;' => "\xC2\xA5",
'yuml' => "\xC3\xBF",
'Yuml;' => "\xC5\xB8",
'yuml;' => "\xC3\xBF",
'Zeta;' => "\xCE\x96",
'zeta;' => "\xCE\xB6",
'zwj;' => "\xE2\x80\x8D",
'zwnj;' => "\xE2\x80\x8C"
];
for ($i = 0, $match = null; $i < 9 && $this->consume() !== false; $i++) {
// Cast for PHPStan on PHP < 8.0: We consumed as per the loop condition,
// so `$this->consumed` is non-empty and the substr offset is valid.
$consumed = (string) substr($this->consumed, 1);
if (isset($entities[$consumed])) {
$match = $consumed;
}
}
if ($match !== null) {
$this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1);
$this->position += strlen($entities[$match]) - strlen($consumed) - 1;
}
break;
}
}
}
PK \ ' library/SimplePie/Decode/HTML/.htaccessnu [ PK \|
library/SimplePie/IRI.phpnu [
*/
protected $default = [
Cache::class => Cache::class,
Locator::class => Locator::class,
Parser::class => Parser::class,
File::class => File::class,
Sanitize::class => Sanitize::class,
Item::class => Item::class,
Author::class => Author::class,
Category::class => Category::class,
Enclosure::class => Enclosure::class,
Caption::class => Caption::class,
Copyright::class => Copyright::class,
Credit::class => Credit::class,
Rating::class => Rating::class,
Restriction::class => Restriction::class,
Sniffer::class => Sniffer::class,
Source::class => Source::class,
Misc::class => Misc::class,
DeclarationParser::class => DeclarationParser::class,
Date::class => Date::class,
];
/**
* Class mapping
*
* @see register()
* @var array
*/
protected $classes = [];
/**
* Legacy classes
*
* @see register()
* @var array
*/
protected $legacy = [];
/**
* Legacy types
*
* @see register()
* @var array
*/
private $legacyTypes = [
'Cache' => Cache::class,
'Locator' => Locator::class,
'Parser' => Parser::class,
'File' => File::class,
'Sanitize' => Sanitize::class,
'Item' => Item::class,
'Author' => Author::class,
'Category' => Category::class,
'Enclosure' => Enclosure::class,
'Caption' => Caption::class,
'Copyright' => Copyright::class,
'Credit' => Credit::class,
'Rating' => Rating::class,
'Restriction' => Restriction::class,
'Content_Type_Sniffer' => Sniffer::class,
'Source' => Source::class,
'Misc' => Misc::class,
'XML_Declaration_Parser' => DeclarationParser::class,
'Parse_Date' => Date::class,
];
/**
* Constructor
*
* No-op
*/
public function __construct()
{
}
/**
* Register a class
*
* @param string $type See {@see $default} for names
* @param class-string $class Class name, must subclass the corresponding default
* @param bool $legacy Whether to enable legacy support for this class
* @return bool Successfulness
*/
public function register(string $type, $class, bool $legacy = false)
{
if (array_key_exists($type, $this->legacyTypes)) {
// trigger_error(sprintf('"%s"(): Using argument #1 ($type) with value "%s" is deprecated since SimplePie 1.8.0, use class-string "%s" instead.', __METHOD__, $type, $this->legacyTypes[$type]), \E_USER_DEPRECATED);
$type = $this->legacyTypes[$type];
}
if (!array_key_exists($type, $this->default)) {
return false;
}
if (!class_exists($class)) {
return false;
}
/** @var string */
$base_class = $this->default[$type];
if (!is_subclass_of($class, $base_class)) {
return false;
}
$this->classes[$type] = $class;
if ($legacy) {
$this->legacy[] = $class;
}
return true;
}
/**
* Get the class registered for a type
*
* Where possible, use {@see create()} or {@see call()} instead
*
* @template T
* @param class-string $type
* @return class-string|null
*/
public function get_class($type)
{
if (array_key_exists($type, $this->legacyTypes)) {
// trigger_error(sprintf('"%s"(): Using argument #1 ($type) with value "%s" is deprecated since SimplePie 1.8.0, use class-string "%s" instead.', __METHOD__, $type, $this->legacyTypes[$type]), \E_USER_DEPRECATED);
$type = $this->legacyTypes[$type];
}
if (!array_key_exists($type, $this->default)) {
return null;
}
// For PHPStan: values in $default should be subtypes of keys.
/** @var class-string */
$class = $this->default[$type];
if (array_key_exists($type, $this->classes)) {
// For PHPStan: values in $classes should be subtypes of keys.
/** @var class-string */
$class = $this->classes[$type];
}
return $class;
}
/**
* Create a new instance of a given type
*
* @template T class-string $type
* @param class-string $type
* @param array $parameters Parameters to pass to the constructor
* @return T Instance of class
*/
public function &create($type, array $parameters = [])
{
$class = $this->get_class($type);
if ($class === null) {
throw new InvalidArgumentException(sprintf(
'%s(): Argument #1 ($type) "%s" not found in class list.',
__METHOD__,
$type
), 1);
}
if (!method_exists($class, '__construct')) {
$instance = new $class();
} else {
$reflector = new \ReflectionClass($class);
// For PHPStan: $class is T.
/** @var T */
$instance = $reflector->newInstanceArgs($parameters);
}
if ($instance instanceof RegistryAware) {
$instance->set_registry($this);
} elseif (method_exists($instance, 'set_registry')) {
trigger_error(sprintf('Using the method "set_registry()" without implementing "%s" is deprecated since SimplePie 1.8.0, implement "%s" in "%s".', RegistryAware::class, RegistryAware::class, $class), \E_USER_DEPRECATED);
$instance->set_registry($this);
}
return $instance;
}
/**
* Call a static method for a type
*
* @param class-string $type
* @param string $method
* @param array $parameters
* @return mixed
*/
public function &call($type, string $method, array $parameters = [])
{
$class = $this->get_class($type);
if ($class === null) {
throw new InvalidArgumentException(sprintf(
'%s(): Argument #1 ($type) "%s" not found in class list.',
__METHOD__,
$type
), 1);
}
if (in_array($class, $this->legacy)) {
switch ($type) {
case Cache::class:
// For backwards compatibility with old non-static
// Cache::create() methods in PHP < 8.0.
// No longer supported as of PHP 8.0.
if ($method === 'get_handler') {
// Fixing this PHPStan error breaks CacheTest::testDirectOverrideLegacy()
/** @phpstan-ignore argument.type */
$result = @call_user_func_array([$class, 'create'], $parameters);
return $result;
}
break;
}
}
$callable = [$class, $method];
assert(is_callable($callable), 'For PHPstan');
$result = call_user_func_array($callable, $parameters);
return $result;
}
}
class_alias('SimplePie\Registry', 'SimplePie_Registry');
PK \*_c c src/Exception.phpnu [ >
*/
private $headers = [];
/**
* @var string
*/
private $requested_url;
public function __construct(string $raw_text, string $filepath)
{
$this->raw_text = $raw_text;
$this->permanent_url = $filepath;
$this->requested_url = $filepath;
}
public function get_permanent_uri(): string
{
return $this->permanent_url;
}
public function get_final_requested_uri(): string
{
return $this->requested_url;
}
public function get_status_code(): int
{
return 200;
}
public function get_headers(): array
{
return $this->headers;
}
public function has_header(string $name): bool
{
return isset($this->headers[strtolower($name)]);
}
public function get_header(string $name): array
{
return isset($this->headers[strtolower($name)]) ? $this->headers[$name] : [];
}
public function with_header(string $name, $value)
{
$new = clone $this;
$newHeader = [
strtolower($name) => (array) $value,
];
$new->headers = $newHeader + $this->headers;
return $new;
}
public function get_header_line(string $name): string
{
return isset($this->headers[strtolower($name)]) ? implode(", ", $this->headers[$name]) : '';
}
public function get_body_content(): string
{
return $this->raw_text;
}
}
PK \NRW_ _ src/HTTP/Psr18Client.phpnu [ httpClient = $httpClient;
$this->requestFactory = $requestFactory;
$this->uriFactory = $uriFactory;
}
public function getHttpClient(): ClientInterface
{
return $this->httpClient;
}
public function getRequestFactory(): RequestFactoryInterface
{
return $this->requestFactory;
}
public function getUriFactory(): UriFactoryInterface
{
return $this->uriFactory;
}
/**
* send a request and return the response
*
* @param Client::METHOD_* $method
* @param string $url
* @param array $headers
*
* @throws ClientException if anything goes wrong requesting the data
*/
public function request(string $method, string $url, array $headers = []): Response
{
if ($method !== self::METHOD_GET) {
throw new InvalidArgumentException(sprintf(
'%s(): Argument #1 ($method) only supports method "%s".',
__METHOD__,
self::METHOD_GET
), 1);
}
if (preg_match('/^http(s)?:\/\//i', $url)) {
return $this->requestUrl($method, $url, $headers);
}
return $this->requestLocalFile($url);
}
/**
* @param array $headers
*/
private function requestUrl(string $method, string $url, array $headers): Response
{
$permanentUrl = $url;
$requestedUrl = $url;
$remainingRedirects = $this->allowedRedirects;
$request = $this->requestFactory->createRequest(
$method,
$this->uriFactory->createUri($requestedUrl)
);
foreach ($headers as $name => $value) {
$request = $request->withHeader($name, $value);
}
do {
$followRedirect = false;
try {
$response = $this->httpClient->sendRequest($request);
} catch (ClientExceptionInterface $th) {
throw new ClientException($th->getMessage(), $th->getCode(), $th);
}
$statusCode = $response->getStatusCode();
// If we have a redirect
if (in_array($statusCode, [300, 301, 302, 303, 307]) && $response->hasHeader('Location')) {
// Prevent infinity redirect loops
if ($remainingRedirects <= 0) {
break;
}
$remainingRedirects--;
$followRedirect = true;
$requestedUrl = $response->getHeaderLine('Location');
if ($statusCode === 301) {
$permanentUrl = $requestedUrl;
}
$request = $request->withUri($this->uriFactory->createUri($requestedUrl));
}
} while ($followRedirect);
return new Psr7Response($response, $permanentUrl, $requestedUrl);
}
private function requestLocalFile(string $path): Response
{
if (!is_readable($path)) {
throw new ClientException(sprintf('file "%s" is not readable', $path));
}
try {
$raw = file_get_contents($path);
} catch (Throwable $th) {
throw new ClientException($th->getMessage(), $th->getCode(), $th);
}
if ($raw === false) {
throw new ClientException('file_get_contents() could not read the file', 1);
}
return new RawTextResponse($raw, $path);
}
}
PK \;'ؙ src/HTTP/Response.phpnu [ get_headers() as $name => $values) {
* echo $name . ': ' . implode(', ', $values);
* }
*
* // Emit headers iteratively:
* foreach ($message->get_headers() as $name => $values) {
* foreach ($values as $value) {
* header(sprintf('%s: %s', $name, $value), false);
* }
* }
*
* @return array> Returns an associative array of the message's headers.
* Each key MUST be a header name, and each value MUST be an array of
* strings for that header.
*/
public function get_headers(): array;
/**
* Checks if a header exists by the given case-insensitive name.
*
* @param string $name Case-insensitive header field name.
* @return bool Returns true if any header names match the given header
* name using a case-insensitive string comparison. Returns false if
* no matching header name is found in the message.
*/
public function has_header(string $name): bool;
/**
* Retrieves a message header value by the given case-insensitive name.
*
* This method returns an array of all the header values of the given
* case-insensitive header name.
*
* If the header does not appear in the message, this method MUST return an
* empty array.
*
* @param string $name Case-insensitive header field name.
* @return string[] An array of string values as provided for the given
* header. If the header does not appear in the message, this method MUST
* return an empty array.
*/
public function get_header(string $name): array;
/**
* Return an instance with the provided value replacing the specified header.
*
* This method MUST be implemented in such a way as to retain the
* immutability of the message, and MUST return an instance that has the
* new and/or updated header and value.
*
* @param string $name Case-insensitive header field name.
* @param string|non-empty-array $value Header value(s).
* @return static
* @throws \InvalidArgumentException for invalid header names or values.
*/
public function with_header(string $name, $value);
/**
* Retrieves a comma-separated string of the values for a single header.
*
* This method returns all of the header values of the given
* case-insensitive header name as a string concatenated together using
* a comma.
*
* NOTE: Not all header values may be appropriately represented using
* comma concatenation. For such headers, use getHeader() instead
* and supply your own delimiter when concatenating.
*
* If the header does not appear in the message, this method MUST return
* an empty string.
*
* @param string $name Case-insensitive header field name.
* @return string A string of values as provided for the given header
* concatenated together using a comma. If the header does not appear in
* the message, this method MUST return an empty string.
*/
public function get_header_line(string $name): string;
/**
* get the body as string
*
* @return string
*/
public function get_body_content(): string;
}
PK \7ȁ src/HTTP/Psr7Response.phpnu [ response = $response;
$this->permanent_url = $permanent_url;
$this->requested_url = $requested_url;
}
public function get_permanent_uri(): string
{
return $this->permanent_url;
}
public function get_final_requested_uri(): string
{
return $this->requested_url;
}
public function get_status_code(): int
{
return $this->response->getStatusCode();
}
public function get_headers(): array
{
// The filtering is probably redundant but let’s make PHPStan happy.
return array_filter($this->response->getHeaders(), function (array $header): bool {
return count($header) >= 1;
});
}
public function has_header(string $name): bool
{
return $this->response->hasHeader($name);
}
public function with_header(string $name, $value)
{
return new self($this->response->withHeader($name, $value), $this->permanent_url, $this->requested_url);
}
public function get_header(string $name): array
{
return $this->response->getHeader($name);
}
public function get_header_line(string $name): string
{
return $this->response->getHeaderLine($name);
}
public function get_body_content(): string
{
return $this->response->getBody()->__toString();
}
}
PK \Y "] ] src/HTTP/error_lognu [ [23-Dec-2025 11:33:01 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[23-Dec-2025 11:33:03 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[23-Dec-2025 11:33:05 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[23-Dec-2025 11:33:08 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[23-Dec-2025 11:33:10 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[23-Dec-2025 11:53:58 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[23-Dec-2025 11:54:00 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[23-Dec-2025 11:54:02 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[23-Dec-2025 11:54:02 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[23-Dec-2025 11:54:03 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[24-Dec-2025 14:45:51 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[24-Dec-2025 14:45:54 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[24-Dec-2025 14:45:56 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[24-Dec-2025 14:45:58 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[24-Dec-2025 14:45:59 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[24-Dec-2025 15:11:13 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[24-Dec-2025 15:11:15 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[24-Dec-2025 15:11:17 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[24-Dec-2025 15:11:18 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[24-Dec-2025 15:11:20 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[04-Jan-2026 10:04:48 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[04-Jan-2026 10:04:49 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[04-Jan-2026 10:04:49 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[04-Jan-2026 10:04:49 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[04-Jan-2026 10:04:50 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[04-Jan-2026 10:14:44 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[04-Jan-2026 10:14:44 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[04-Jan-2026 10:14:44 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[04-Jan-2026 10:14:45 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[04-Jan-2026 10:14:45 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[05-Jan-2026 18:30:37 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[05-Jan-2026 18:30:38 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[05-Jan-2026 18:30:40 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[05-Jan-2026 18:30:41 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[05-Jan-2026 18:30:41 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[06-Jan-2026 01:14:47 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[06-Jan-2026 01:14:48 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[06-Jan-2026 01:14:50 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[06-Jan-2026 01:14:51 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[06-Jan-2026 01:14:53 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[06-Jan-2026 01:28:10 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[06-Jan-2026 01:28:10 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[06-Jan-2026 01:28:11 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[06-Jan-2026 01:28:11 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[06-Jan-2026 01:28:13 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[06-Jan-2026 02:33:13 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[06-Jan-2026 02:34:00 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[06-Jan-2026 02:40:24 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[06-Jan-2026 02:41:03 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[06-Jan-2026 02:43:12 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[07-Jan-2026 04:26:13 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[07-Jan-2026 04:26:13 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[07-Jan-2026 04:26:13 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[07-Jan-2026 04:26:14 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[07-Jan-2026 04:26:14 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[13-Jan-2026 06:28:01 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[13-Jan-2026 06:28:02 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[13-Jan-2026 06:28:02 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[13-Jan-2026 06:28:03 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[13-Jan-2026 06:28:03 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[13-Jan-2026 23:47:21 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[13-Jan-2026 23:47:24 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[13-Jan-2026 23:47:26 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[13-Jan-2026 23:47:29 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[13-Jan-2026 23:47:31 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[14-Jan-2026 00:08:04 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[14-Jan-2026 00:08:05 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[14-Jan-2026 00:08:09 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[14-Jan-2026 00:08:11 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[14-Jan-2026 00:08:12 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
[21-Feb-2026 02:55:45 UTC] PHP Fatal error: Uncaught Error: Class 'SimplePie\Exception' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php:17
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/ClientException.php on line 17
[21-Feb-2026 02:55:45 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php:21
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/FileClient.php on line 21
[21-Feb-2026 02:55:45 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php:20
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr7Response.php on line 20
[21-Feb-2026 02:55:46 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Client' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php:22
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/Psr18Client.php on line 22
[21-Feb-2026 02:55:46 UTC] PHP Fatal error: Uncaught Error: Interface 'SimplePie\HTTP\Response' not found in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php:18
Stack trace:
#0 {main}
thrown in /home/antiaginglove/public_html/wp-includes/SimplePie/src/HTTP/RawTextResponse.php on line 18
PK \ZOi; i; src/HTTP/Parser.phpnu [ > : array)
*/
public $headers = [];
/**
* Body of the response
*
* @var string
*/
public $body = '';
private const STATE_HTTP_VERSION = 'http_version';
private const STATE_STATUS = 'status';
private const STATE_REASON = 'reason';
private const STATE_NEW_LINE = 'new_line';
private const STATE_BODY = 'body';
private const STATE_NAME = 'name';
private const STATE_VALUE = 'value';
private const STATE_VALUE_CHAR = 'value_char';
private const STATE_QUOTE = 'quote';
private const STATE_QUOTE_ESCAPED = 'quote_escaped';
private const STATE_QUOTE_CHAR = 'quote_char';
private const STATE_CHUNKED = 'chunked';
private const STATE_EMIT = 'emit';
private const STATE_ERROR = false;
/**
* Current state of the state machine
*
* @var self::STATE_*
*/
protected $state = self::STATE_HTTP_VERSION;
/**
* Input data
*
* @var string
*/
protected $data = '';
/**
* Input data length (to avoid calling strlen() everytime this is needed)
*
* @var int
*/
protected $data_length = 0;
/**
* Current position of the pointer
*
* @var int
*/
protected $position = 0;
/**
* Name of the header currently being parsed
*
* @var string
*/
protected $name = '';
/**
* Value of the header currently being parsed
*
* @var string
*/
protected $value = '';
/**
* Create an instance of the class with the input data
*
* @param string $data Input data
* @param Psr7Compatible $psr7Compatible Whether the data types are in format compatible with PSR-7.
*/
public function __construct(string $data, bool $psr7Compatible = false)
{
$this->data = $data;
$this->data_length = strlen($this->data);
$this->psr7Compatible = $psr7Compatible;
}
/**
* Parse the input data
*
* @return bool true on success, false on failure
*/
public function parse()
{
while ($this->state && $this->state !== self::STATE_EMIT && $this->has_data()) {
$state = $this->state;
$this->$state();
}
$this->data = '';
if ($this->state === self::STATE_EMIT || $this->state === self::STATE_BODY) {
return true;
}
// Reset the parser state.
$this->http_version = 0.0;
$this->status_code = 0;
$this->reason = '';
$this->headers = [];
$this->body = '';
return false;
}
/**
* Check whether there is data beyond the pointer
*
* @return bool true if there is further data, false if not
*/
protected function has_data()
{
return (bool) ($this->position < $this->data_length);
}
/**
* See if the next character is LWS
*
* @return bool true if the next character is LWS, false if not
*/
protected function is_linear_whitespace()
{
return (bool) ($this->data[$this->position] === "\x09"
|| $this->data[$this->position] === "\x20"
|| ($this->data[$this->position] === "\x0A"
&& isset($this->data[$this->position + 1])
&& ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20")));
}
/**
* Parse the HTTP version
* @return void
*/
protected function http_version()
{
if (strpos($this->data, "\x0A") !== false && strtoupper(substr($this->data, 0, 5)) === 'HTTP/') {
$len = strspn($this->data, '0123456789.', 5);
$http_version = substr($this->data, 5, $len);
$this->position += 5 + $len;
if (substr_count($http_version, '.') <= 1) {
$this->http_version = (float) $http_version;
$this->position += strspn($this->data, "\x09\x20", $this->position);
$this->state = self::STATE_STATUS;
} else {
$this->state = self::STATE_ERROR;
}
} else {
$this->state = self::STATE_ERROR;
}
}
/**
* Parse the status code
* @return void
*/
protected function status()
{
if ($len = strspn($this->data, '0123456789', $this->position)) {
$this->status_code = (int) substr($this->data, $this->position, $len);
$this->position += $len;
$this->state = self::STATE_REASON;
} else {
$this->state = self::STATE_ERROR;
}
}
/**
* Parse the reason phrase
* @return void
*/
protected function reason()
{
$len = strcspn($this->data, "\x0A", $this->position);
$this->reason = trim(substr($this->data, $this->position, $len), "\x09\x0D\x20");
$this->position += $len + 1;
$this->state = self::STATE_NEW_LINE;
}
private function add_header(string $name, string $value): void
{
if ($this->psr7Compatible) {
// For PHPStan: should be enforced by template parameter but PHPStan is not smart enough.
/** @var array> */
$headers = &$this->headers;
$headers[$name][] = $value;
} else {
// For PHPStan: should be enforced by template parameter but PHPStan is not smart enough.
/** @var array) */
$headers = &$this->headers;
$headers[$name] .= ', ' . $value;
}
}
private function replace_header(string $name, string $value): void
{
if ($this->psr7Compatible) {
// For PHPStan: should be enforced by template parameter but PHPStan is not smart enough.
/** @var array> */
$headers = &$this->headers;
$headers[$name] = [$value];
} else {
// For PHPStan: should be enforced by template parameter but PHPStan is not smart enough.
/** @var array) */
$headers = &$this->headers;
$headers[$name] = $value;
}
}
/**
* Deal with a new line, shifting data around as needed
* @return void
*/
protected function new_line()
{
$this->value = trim($this->value, "\x0D\x20");
if ($this->name !== '' && $this->value !== '') {
$this->name = strtolower($this->name);
// We should only use the last Content-Type header. c.f. issue #1
if (isset($this->headers[$this->name]) && $this->name !== 'content-type') {
$this->add_header($this->name, $this->value);
} else {
$this->replace_header($this->name, $this->value);
}
}
$this->name = '';
$this->value = '';
if (substr($this->data[$this->position], 0, 2) === "\x0D\x0A") {
$this->position += 2;
$this->state = self::STATE_BODY;
} elseif ($this->data[$this->position] === "\x0A") {
$this->position++;
$this->state = self::STATE_BODY;
} else {
$this->state = self::STATE_NAME;
}
}
/**
* Parse a header name
* @return void
*/
protected function name()
{
$len = strcspn($this->data, "\x0A:", $this->position);
if (isset($this->data[$this->position + $len])) {
if ($this->data[$this->position + $len] === "\x0A") {
$this->position += $len;
$this->state = self::STATE_NEW_LINE;
} else {
$this->name = substr($this->data, $this->position, $len);
$this->position += $len + 1;
$this->state = self::STATE_VALUE;
}
} else {
$this->state = self::STATE_ERROR;
}
}
/**
* Parse LWS, replacing consecutive LWS characters with a single space
* @return void
*/
protected function linear_whitespace()
{
do {
if (substr($this->data, $this->position, 2) === "\x0D\x0A") {
$this->position += 2;
} elseif ($this->data[$this->position] === "\x0A") {
$this->position++;
}
$this->position += strspn($this->data, "\x09\x20", $this->position);
} while ($this->has_data() && $this->is_linear_whitespace());
$this->value .= "\x20";
}
/**
* See what state to move to while within non-quoted header values
* @return void
*/
protected function value()
{
if ($this->is_linear_whitespace()) {
$this->linear_whitespace();
} else {
switch ($this->data[$this->position]) {
case '"':
// Workaround for ETags: we have to include the quotes as
// part of the tag.
if (strtolower($this->name) === 'etag') {
$this->value .= '"';
$this->position++;
$this->state = self::STATE_VALUE_CHAR;
break;
}
$this->position++;
$this->state = self::STATE_QUOTE;
break;
case "\x0A":
$this->position++;
$this->state = self::STATE_NEW_LINE;
break;
default:
$this->state = self::STATE_VALUE_CHAR;
break;
}
}
}
/**
* Parse a header value while outside quotes
* @return void
*/
protected function value_char()
{
$len = strcspn($this->data, "\x09\x20\x0A\"", $this->position);
$this->value .= substr($this->data, $this->position, $len);
$this->position += $len;
$this->state = self::STATE_VALUE;
}
/**
* See what state to move to while within quoted header values
* @return void
*/
protected function quote()
{
if ($this->is_linear_whitespace()) {
$this->linear_whitespace();
} else {
switch ($this->data[$this->position]) {
case '"':
$this->position++;
$this->state = self::STATE_VALUE;
break;
case "\x0A":
$this->position++;
$this->state = self::STATE_NEW_LINE;
break;
case '\\':
$this->position++;
$this->state = self::STATE_QUOTE_ESCAPED;
break;
default:
$this->state = self::STATE_QUOTE_CHAR;
break;
}
}
}
/**
* Parse a header value while within quotes
* @return void
*/
protected function quote_char()
{
$len = strcspn($this->data, "\x09\x20\x0A\"\\", $this->position);
$this->value .= substr($this->data, $this->position, $len);
$this->position += $len;
$this->state = self::STATE_VALUE;
}
/**
* Parse an escaped character within quotes
* @return void
*/
protected function quote_escaped()
{
$this->value .= $this->data[$this->position];
$this->position++;
$this->state = self::STATE_QUOTE;
}
/**
* Parse the body
* @return void
*/
protected function body()
{
$this->body = substr($this->data, $this->position);
if (!empty($this->headers['transfer-encoding'])) {
unset($this->headers['transfer-encoding']);
$this->state = self::STATE_CHUNKED;
} else {
$this->state = self::STATE_EMIT;
}
}
/**
* Parsed a "Transfer-Encoding: chunked" body
* @return void
*/
protected function chunked()
{
if (!preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', trim($this->body))) {
$this->state = self::STATE_EMIT;
return;
}
$decoded = '';
$encoded = $this->body;
while (true) {
$is_chunked = (bool) preg_match('/^([0-9a-f]+)[^\r\n]*\r\n/i', $encoded, $matches);
if (!$is_chunked) {
// Looks like it's not chunked after all
$this->state = self::STATE_EMIT;
return;
}
$length = hexdec(trim($matches[1]));
// For PHPStan: this will only be float when larger than PHP_INT_MAX.
// But even on 32-bit systems, it would mean 2GiB chunk, which sounds unlikely.
\assert(\is_int($length), "Length needs to be shorter than PHP_INT_MAX");
if ($length === 0) {
// Ignore trailer headers
$this->state = self::STATE_EMIT;
$this->body = $decoded;
return;
}
$chunk_length = strlen($matches[0]);
$decoded .= substr($encoded, $chunk_length, $length);
$encoded = substr($encoded, $chunk_length + $length + 2);
// BC for PHP < 8.0: substr() can return bool instead of string
$encoded = ($encoded === false) ? '' : $encoded;
if (trim($encoded) === '0' || empty($encoded)) {
$this->state = self::STATE_EMIT;
$this->body = $decoded;
return;
}
}
}
/**
* Prepare headers (take care of proxies headers)
*
* @param string $headers Raw headers
* @param non-negative-int $count Redirection count. Default to 1.
*
* @return string
*/
public static function prepareHeaders(string $headers, int $count = 1)
{
$data = explode("\r\n\r\n", $headers, $count);
$data = array_pop($data);
if (false !== stripos($data, "HTTP/1.0 200 Connection established\r\n")) {
$exploded = explode("\r\n\r\n", $data, 2);
$data = end($exploded);
}
if (false !== stripos($data, "HTTP/1.1 200 Connection established\r\n")) {
$exploded = explode("\r\n\r\n", $data, 2);
$data = end($exploded);
}
return $data;
}
}
class_alias('SimplePie\HTTP\Parser', 'SimplePie_HTTP_Parser');
PK \ src/HTTP/FileClient.phpnu [ } */
private $options;
/**
* @param array{timeout?: int, redirects?: int, useragent?: string, force_fsockopen?: bool, curl_options?: array} $options
*/
public function __construct(Registry $registry, array $options = [])
{
$this->registry = $registry;
$this->options = $options;
}
/**
* send a request and return the response
*
* @param Client::METHOD_* $method
* @param array $headers
*
* @throws ClientException if anything goes wrong requesting the data
*/
public function request(string $method, string $url, array $headers = []): Response
{
// @phpstan-ignore-next-line Enforce PHPDoc type.
if ($method !== self::METHOD_GET) {
throw new InvalidArgumentException(sprintf(
'%s(): Argument #1 ($method) only supports method "%s".',
__METHOD__,
self::METHOD_GET
), 1);
}
try {
$file = $this->registry->create(File::class, [
$url,
$this->options['timeout'] ?? 10,
$this->options['redirects'] ?? 5,
$headers,
$this->options['useragent'] ?? Misc::get_default_useragent(),
$this->options['force_fsockopen'] ?? false,
$this->options['curl_options'] ?? []
]);
} catch (Throwable $th) {
throw new ClientException($th->getMessage(), $th->getCode(), $th);
}
if ($file->error !== null && $file->get_status_code() === 0) {
throw new ClientException($file->error);
}
return $file;
}
}
PK \ src/HTTP/.htaccessnu [ PK \f|M M src/HTTP/ClientException.phpnu [ $headers
*
* @throws ClientException if anything goes wrong requesting the data
*/
public function request(string $method, string $url, array $headers = []): Response;
}
PK \;44 4 src/SimplePie.phpnu [ ' . self::NAME . '';
/**
* No Autodiscovery
* @see SimplePie::set_autodiscovery_level()
*/
public const LOCATOR_NONE = 0;
/**
* Feed Link Element Autodiscovery
* @see SimplePie::set_autodiscovery_level()
*/
public const LOCATOR_AUTODISCOVERY = 1;
/**
* Local Feed Extension Autodiscovery
* @see SimplePie::set_autodiscovery_level()
*/
public const LOCATOR_LOCAL_EXTENSION = 2;
/**
* Local Feed Body Autodiscovery
* @see SimplePie::set_autodiscovery_level()
*/
public const LOCATOR_LOCAL_BODY = 4;
/**
* Remote Feed Extension Autodiscovery
* @see SimplePie::set_autodiscovery_level()
*/
public const LOCATOR_REMOTE_EXTENSION = 8;
/**
* Remote Feed Body Autodiscovery
* @see SimplePie::set_autodiscovery_level()
*/
public const LOCATOR_REMOTE_BODY = 16;
/**
* All Feed Autodiscovery
* @see SimplePie::set_autodiscovery_level()
*/
public const LOCATOR_ALL = 31;
/**
* No known feed type
*/
public const TYPE_NONE = 0;
/**
* RSS 0.90
*/
public const TYPE_RSS_090 = 1;
/**
* RSS 0.91 (Netscape)
*/
public const TYPE_RSS_091_NETSCAPE = 2;
/**
* RSS 0.91 (Userland)
*/
public const TYPE_RSS_091_USERLAND = 4;
/**
* RSS 0.91 (both Netscape and Userland)
*/
public const TYPE_RSS_091 = 6;
/**
* RSS 0.92
*/
public const TYPE_RSS_092 = 8;
/**
* RSS 0.93
*/
public const TYPE_RSS_093 = 16;
/**
* RSS 0.94
*/
public const TYPE_RSS_094 = 32;
/**
* RSS 1.0
*/
public const TYPE_RSS_10 = 64;
/**
* RSS 2.0
*/
public const TYPE_RSS_20 = 128;
/**
* RDF-based RSS
*/
public const TYPE_RSS_RDF = 65;
/**
* Non-RDF-based RSS (truly intended as syndication format)
*/
public const TYPE_RSS_SYNDICATION = 190;
/**
* All RSS
*/
public const TYPE_RSS_ALL = 255;
/**
* Atom 0.3
*/
public const TYPE_ATOM_03 = 256;
/**
* Atom 1.0
*/
public const TYPE_ATOM_10 = 512;
/**
* All Atom
*/
public const TYPE_ATOM_ALL = 768;
/**
* All feed types
*/
public const TYPE_ALL = 1023;
/**
* No construct
*/
public const CONSTRUCT_NONE = 0;
/**
* Text construct
*/
public const CONSTRUCT_TEXT = 1;
/**
* HTML construct
*/
public const CONSTRUCT_HTML = 2;
/**
* XHTML construct
*/
public const CONSTRUCT_XHTML = 4;
/**
* base64-encoded construct
*/
public const CONSTRUCT_BASE64 = 8;
/**
* IRI construct
*/
public const CONSTRUCT_IRI = 16;
/**
* A construct that might be HTML
*/
public const CONSTRUCT_MAYBE_HTML = 32;
/**
* All constructs
*/
public const CONSTRUCT_ALL = 63;
/**
* Don't change case
*/
public const SAME_CASE = 1;
/**
* Change to lowercase
*/
public const LOWERCASE = 2;
/**
* Change to uppercase
*/
public const UPPERCASE = 4;
/**
* PCRE for HTML attributes
*/
public const PCRE_HTML_ATTRIBUTE = '((?:[\x09\x0A\x0B\x0C\x0D\x20]+[^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"(?:[^"]*)"|\'(?:[^\']*)\'|(?:[^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?)*)[\x09\x0A\x0B\x0C\x0D\x20]*';
/**
* PCRE for XML attributes
*/
public const PCRE_XML_ATTRIBUTE = '((?:\s+(?:(?:[^\s:]+:)?[^\s:]+)\s*=\s*(?:"(?:[^"]*)"|\'(?:[^\']*)\'))*)\s*';
/**
* XML Namespace
*/
public const NAMESPACE_XML = 'http://www.w3.org/XML/1998/namespace';
/**
* Atom 1.0 Namespace
*/
public const NAMESPACE_ATOM_10 = 'http://www.w3.org/2005/Atom';
/**
* Atom 0.3 Namespace
*/
public const NAMESPACE_ATOM_03 = 'http://purl.org/atom/ns#';
/**
* RDF Namespace
*/
public const NAMESPACE_RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
/**
* RSS 0.90 Namespace
*/
public const NAMESPACE_RSS_090 = 'http://my.netscape.com/rdf/simple/0.9/';
/**
* RSS 1.0 Namespace
*/
public const NAMESPACE_RSS_10 = 'http://purl.org/rss/1.0/';
/**
* RSS 1.0 Content Module Namespace
*/
public const NAMESPACE_RSS_10_MODULES_CONTENT = 'http://purl.org/rss/1.0/modules/content/';
/**
* RSS 2.0 Namespace
* (Stupid, I know, but I'm certain it will confuse people less with support.)
*/
public const NAMESPACE_RSS_20 = '';
/**
* DC 1.0 Namespace
*/
public const NAMESPACE_DC_10 = 'http://purl.org/dc/elements/1.0/';
/**
* DC 1.1 Namespace
*/
public const NAMESPACE_DC_11 = 'http://purl.org/dc/elements/1.1/';
/**
* W3C Basic Geo (WGS84 lat/long) Vocabulary Namespace
*/
public const NAMESPACE_W3C_BASIC_GEO = 'http://www.w3.org/2003/01/geo/wgs84_pos#';
/**
* GeoRSS Namespace
*/
public const NAMESPACE_GEORSS = 'http://www.georss.org/georss';
/**
* Media RSS Namespace
*/
public const NAMESPACE_MEDIARSS = 'http://search.yahoo.com/mrss/';
/**
* Wrong Media RSS Namespace. Caused by a long-standing typo in the spec.
*/
public const NAMESPACE_MEDIARSS_WRONG = 'http://search.yahoo.com/mrss';
/**
* Wrong Media RSS Namespace #2. New namespace introduced in Media RSS 1.5.
*/
public const NAMESPACE_MEDIARSS_WRONG2 = 'http://video.search.yahoo.com/mrss';
/**
* Wrong Media RSS Namespace #3. A possible typo of the Media RSS 1.5 namespace.
*/
public const NAMESPACE_MEDIARSS_WRONG3 = 'http://video.search.yahoo.com/mrss/';
/**
* Wrong Media RSS Namespace #4. New spec location after the RSS Advisory Board takes it over, but not a valid namespace.
*/
public const NAMESPACE_MEDIARSS_WRONG4 = 'http://www.rssboard.org/media-rss';
/**
* Wrong Media RSS Namespace #5. A possible typo of the RSS Advisory Board URL.
*/
public const NAMESPACE_MEDIARSS_WRONG5 = 'http://www.rssboard.org/media-rss/';
/**
* iTunes RSS Namespace
*/
public const NAMESPACE_ITUNES = 'http://www.itunes.com/dtds/podcast-1.0.dtd';
/**
* XHTML Namespace
*/
public const NAMESPACE_XHTML = 'http://www.w3.org/1999/xhtml';
/**
* IANA Link Relations Registry
*/
public const IANA_LINK_RELATIONS_REGISTRY = 'http://www.iana.org/assignments/relation/';
/**
* No file source
*/
public const FILE_SOURCE_NONE = 0;
/**
* Remote file source
*/
public const FILE_SOURCE_REMOTE = 1;
/**
* Local file source
*/
public const FILE_SOURCE_LOCAL = 2;
/**
* fsockopen() file source
*/
public const FILE_SOURCE_FSOCKOPEN = 4;
/**
* cURL file source
*/
public const FILE_SOURCE_CURL = 8;
/**
* file_get_contents() file source
*/
public const FILE_SOURCE_FILE_GET_CONTENTS = 16;
/**
* @internal Default value of the HTTP Accept header when fetching/locating feeds
*/
public const DEFAULT_HTTP_ACCEPT_HEADER = 'application/atom+xml, application/rss+xml, application/rdf+xml;q=0.9, application/xml;q=0.8, text/xml;q=0.8, text/html;q=0.7, unknown/unknown;q=0.1, application/unknown;q=0.1, */*;q=0.1';
/**
* @var array Raw data
* @access private
*/
public $data = [];
/**
* @var string|string[]|null Error string (or array when multiple feeds are initialized)
* @access private
*/
public $error = null;
/**
* @var int HTTP status code
* @see SimplePie::status_code()
* @access private
*/
public $status_code = 0;
/**
* @var Sanitize instance of Sanitize class
* @see SimplePie::set_sanitize_class()
* @access private
*/
public $sanitize;
/**
* @var string SimplePie Useragent
* @see SimplePie::set_useragent()
* @access private
*/
public $useragent = '';
/**
* @var string Feed URL
* @see SimplePie::set_feed_url()
* @access private
*/
public $feed_url;
/**
* @var ?string Original feed URL, or new feed URL iff HTTP 301 Moved Permanently
* @see SimplePie::subscribe_url()
* @access private
*/
public $permanent_url = null;
/**
* @var File Instance of File class to use as a feed
* @see SimplePie::set_file()
*/
private $file;
/**
* @var string|false Raw feed data
* @see SimplePie::set_raw_data()
* @access private
*/
public $raw_data;
/**
* @var int Timeout for fetching remote files
* @see SimplePie::set_timeout()
* @access private
*/
public $timeout = 10;
/**
* @var array Custom curl options
* @see SimplePie::set_curl_options()
* @access private
*/
public $curl_options = [];
/**
* @var bool Forces fsockopen() to be used for remote files instead
* of cURL, even if a new enough version is installed
* @see SimplePie::force_fsockopen()
* @access private
*/
public $force_fsockopen = false;
/**
* @var bool Force the given data/URL to be treated as a feed no matter what
* it appears like
* @see SimplePie::force_feed()
* @access private
*/
public $force_feed = false;
/**
* @var bool Enable/Disable Caching
* @see SimplePie::enable_cache()
* @access private
*/
private $enable_cache = true;
/**
* @var DataCache|null
* @see SimplePie::set_cache()
*/
private $cache = null;
/**
* @var NameFilter
* @see SimplePie::set_cache_namefilter()
*/
private $cache_namefilter;
/**
* @var bool Force SimplePie to fallback to expired cache, if enabled,
* when feed is unavailable.
* @see SimplePie::force_cache_fallback()
* @access private
*/
public $force_cache_fallback = false;
/**
* @var int Cache duration (in seconds)
* @see SimplePie::set_cache_duration()
* @access private
*/
public $cache_duration = 3600;
/**
* @var int Auto-discovery cache duration (in seconds)
* @see SimplePie::set_autodiscovery_cache_duration()
* @access private
*/
public $autodiscovery_cache_duration = 604800; // 7 Days.
/**
* @var string Cache location (relative to executing script)
* @see SimplePie::set_cache_location()
* @access private
*/
public $cache_location = './cache';
/**
* @var string&(callable(string): string) Function that creates the cache filename
* @see SimplePie::set_cache_name_function()
* @access private
*/
public $cache_name_function = 'md5';
/**
* @var bool Reorder feed by date descending
* @see SimplePie::enable_order_by_date()
* @access private
*/
public $order_by_date = true;
/**
* @var mixed Force input encoding to be set to the follow value
* (false, or anything type-cast to false, disables this feature)
* @see SimplePie::set_input_encoding()
* @access private
*/
public $input_encoding = false;
/**
* @var self::LOCATOR_* Feed Autodiscovery Level
* @see SimplePie::set_autodiscovery_level()
* @access private
*/
public $autodiscovery = self::LOCATOR_ALL;
/**
* Class registry object
*
* @var Registry
*/
public $registry;
/**
* @var int Maximum number of feeds to check with autodiscovery
* @see SimplePie::set_max_checked_feeds()
* @access private
*/
public $max_checked_feeds = 10;
/**
* @var array|null All the feeds found during the autodiscovery process
* @see SimplePie::get_all_discovered_feeds()
* @access private
*/
public $all_discovered_feeds = [];
/**
* @var string Web-accessible path to the handler_image.php file.
* @see SimplePie::set_image_handler()
* @access private
*/
public $image_handler = '';
/**
* @var array Stores the URLs when multiple feeds are being initialized.
* @see SimplePie::set_feed_url()
* @access private
*/
public $multifeed_url = [];
/**
* @var array Stores SimplePie objects when multiple feeds initialized.
* @access private
*/
public $multifeed_objects = [];
/**
* @var array Stores the get_object_vars() array for use with multifeeds.
* @see SimplePie::set_feed_url()
* @access private
*/
public $config_settings = null;
/**
* @var int Stores the number of items to return per-feed with multifeeds.
* @see SimplePie::set_item_limit()
* @access private
*/
public $item_limit = 0;
/**
* @var bool Stores if last-modified and/or etag headers were sent with the
* request when checking a feed.
*/
public $check_modified = false;
/**
* @var array Stores the default attributes to be stripped by strip_attributes().
* @see SimplePie::strip_attributes()
* @access private
*/
public $strip_attributes = ['bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'];
/**
* @var array> Stores the default attributes to add to different tags by add_attributes().
* @see SimplePie::add_attributes()
* @access private
*/
public $add_attributes = ['audio' => ['preload' => 'none'], 'iframe' => ['sandbox' => 'allow-scripts allow-same-origin'], 'video' => ['preload' => 'none']];
/**
* @var array Stores the default tags to be stripped by strip_htmltags().
* @see SimplePie::strip_htmltags()
* @access private
*/
public $strip_htmltags = ['base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'];
/**
* @var string[]|string Stores the default attributes to be renamed by rename_attributes().
* @see SimplePie::rename_attributes()
* @access private
*/
public $rename_attributes = [];
/**
* @var bool Should we throw exceptions, or use the old-style error property?
* @access private
*/
public $enable_exceptions = false;
/**
* @var Client|null
*/
private $http_client = null;
/** @var bool Whether HTTP client has been injected */
private $http_client_injected = false;
/**
* The SimplePie class contains feed level data and options
*
* To use SimplePie, create the SimplePie object with no parameters. You can
* then set configuration options using the provided methods. After setting
* them, you must initialise the feed using $feed->init(). At that point the
* object's methods and properties will be available to you.
*
* Previously, it was possible to pass in the feed URL along with cache
* options directly into the constructor. This has been removed as of 1.3 as
* it caused a lot of confusion.
*
* @since 1.0 Preview Release
*/
public function __construct()
{
if (version_compare(PHP_VERSION, '7.2', '<')) {
exit('Please upgrade to PHP 7.2 or newer.');
}
$this->set_useragent();
$this->set_cache_namefilter(new CallableNameFilter($this->cache_name_function));
// Other objects, instances created here so we can set options on them
$this->sanitize = new Sanitize();
$this->registry = new Registry();
if (func_num_args() > 0) {
trigger_error('Passing parameters to the constructor is no longer supported. Please use set_feed_url(), set_cache_location(), and set_cache_duration() directly.', \E_USER_DEPRECATED);
$args = func_get_args();
switch (count($args)) {
case 3:
$this->set_cache_duration($args[2]);
// no break
case 2:
$this->set_cache_location($args[1]);
// no break
case 1:
$this->set_feed_url($args[0]);
$this->init();
}
}
}
/**
* Used for converting object to a string
* @return string
*/
public function __toString()
{
return md5(serialize($this->data));
}
/**
* Remove items that link back to this before destroying this object
* @return void
*/
public function __destruct()
{
if (!gc_enabled()) {
if (!empty($this->data['items'])) {
foreach ($this->data['items'] as $item) {
$item->__destruct();
}
unset($item, $this->data['items']);
}
if (!empty($this->data['ordered_items'])) {
foreach ($this->data['ordered_items'] as $item) {
$item->__destruct();
}
unset($item, $this->data['ordered_items']);
}
}
}
/**
* Force the given data/URL to be treated as a feed
*
* This tells SimplePie to ignore the content-type provided by the server.
* Be careful when using this option, as it will also disable autodiscovery.
*
* @since 1.1
* @param bool $enable Force the given data/URL to be treated as a feed
* @return void
*/
public function force_feed(bool $enable = false)
{
$this->force_feed = $enable;
}
/**
* Set the URL of the feed you want to parse
*
* This allows you to enter the URL of the feed you want to parse, or the
* website you want to try to use auto-discovery on. This takes priority
* over any set raw data.
*
* Deprecated since 1.9.0: You can set multiple feeds to mash together by passing an array instead
* of a string for the $url. Remember that with each additional feed comes
* additional processing and resources.
*
* @since 1.0 Preview Release
* @see set_raw_data()
* @param string|string[] $url This is the URL (or (deprecated) array of URLs) that you want to parse.
* @return void
*/
public function set_feed_url($url)
{
$this->multifeed_url = [];
if (is_array($url)) {
trigger_error('Fetching multiple feeds with single SimplePie instance is deprecated since SimplePie 1.9.0, create one SimplePie instance per feed and use SimplePie::merge_items to get a single list of items.', \E_USER_DEPRECATED);
foreach ($url as $value) {
$this->multifeed_url[] = $this->registry->call(Misc::class, 'fix_protocol', [$value, 1]);
}
} else {
$this->feed_url = $this->registry->call(Misc::class, 'fix_protocol', [$url, 1]);
$this->permanent_url = $this->feed_url;
}
}
/**
* Set an instance of {@see File} to use as a feed
*
* @deprecated since SimplePie 1.9.0, use \SimplePie\SimplePie::set_http_client() or \SimplePie\SimplePie::set_raw_data() instead.
*
* @param File &$file
* @return bool True on success, false on failure
*/
public function set_file(File &$file)
{
// trigger_error(sprintf('SimplePie\SimplePie::set_file() is deprecated since SimplePie 1.9.0, please use "SimplePie\SimplePie::set_http_client()" or "SimplePie\SimplePie::set_raw_data()" instead.'), \E_USER_DEPRECATED);
$this->feed_url = $file->get_final_requested_uri();
$this->permanent_url = $this->feed_url;
$this->file = &$file;
return true;
}
/**
* Set the raw XML data to parse
*
* Allows you to use a string of RSS/Atom data instead of a remote feed.
*
* If you have a feed available as a string in PHP, you can tell SimplePie
* to parse that data string instead of a remote feed. Any set feed URL
* takes precedence.
*
* @since 1.0 Beta 3
* @param string $data RSS or Atom data as a string.
* @see set_feed_url()
* @return void
*/
public function set_raw_data(string $data)
{
$this->raw_data = $data;
}
/**
* Set a PSR-18 client and PSR-17 factories
*
* Allows you to use your own HTTP client implementations.
* This will become required with SimplePie 2.0.0.
*/
final public function set_http_client(
ClientInterface $http_client,
RequestFactoryInterface $request_factory,
UriFactoryInterface $uri_factory
): void {
$this->http_client = new Psr18Client($http_client, $request_factory, $uri_factory);
}
/**
* Set the default timeout for fetching remote feeds
*
* This allows you to change the maximum time the feed's server to respond
* and send the feed back.
*
* @since 1.0 Beta 3
* @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed.
* @return void
*/
public function set_timeout(int $timeout = 10)
{
if ($this->http_client_injected) {
throw new SimplePieException(sprintf(
'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure timeout in your HTTP client instead.',
__METHOD__,
self::class
));
}
$this->timeout = (int) $timeout;
// Reset a possible existing FileClient,
// so a new client with the changed value will be created
if (is_object($this->http_client) && $this->http_client instanceof FileClient) {
$this->http_client = null;
} elseif (is_object($this->http_client)) {
// Trigger notice if a PSR-18 client was set
trigger_error(sprintf(
'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure the timeout in your HTTP client instead.',
__METHOD__,
get_class($this)
), \E_USER_NOTICE);
}
}
/**
* Set custom curl options
*
* This allows you to change default curl options
*
* @since 1.0 Beta 3
* @param array $curl_options Curl options to add to default settings
* @return void
*/
public function set_curl_options(array $curl_options = [])
{
if ($this->http_client_injected) {
throw new SimplePieException(sprintf(
'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure custom curl options in your HTTP client instead.',
__METHOD__,
self::class
));
}
$this->curl_options = $curl_options;
// Reset a possible existing FileClient,
// so a new client with the changed value will be created
if (is_object($this->http_client) && $this->http_client instanceof FileClient) {
$this->http_client = null;
} elseif (is_object($this->http_client)) {
// Trigger notice if a PSR-18 client was set
trigger_error(sprintf(
'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure the curl options in your HTTP client instead.',
__METHOD__,
get_class($this)
), \E_USER_NOTICE);
}
}
/**
* Force SimplePie to use fsockopen() instead of cURL
*
* @since 1.0 Beta 3
* @param bool $enable Force fsockopen() to be used
* @return void
*/
public function force_fsockopen(bool $enable = false)
{
if ($this->http_client_injected) {
throw new SimplePieException(sprintf(
'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure fsockopen in your HTTP client instead.',
__METHOD__,
self::class
));
}
$this->force_fsockopen = $enable;
// Reset a possible existing FileClient,
// so a new client with the changed value will be created
if (is_object($this->http_client) && $this->http_client instanceof FileClient) {
$this->http_client = null;
} elseif (is_object($this->http_client)) {
// Trigger notice if a PSR-18 client was set
trigger_error(sprintf(
'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure fsockopen in your HTTP client instead.',
__METHOD__,
get_class($this)
), \E_USER_NOTICE);
}
}
/**
* Enable/disable caching in SimplePie.
*
* This option allows you to disable caching all-together in SimplePie.
* However, disabling the cache can lead to longer load times.
*
* @since 1.0 Preview Release
* @param bool $enable Enable caching
* @return void
*/
public function enable_cache(bool $enable = true)
{
$this->enable_cache = $enable;
}
/**
* Set a PSR-16 implementation as cache
*
* @param CacheInterface $cache The PSR-16 cache implementation
*
* @return void
*/
public function set_cache(CacheInterface $cache)
{
$this->cache = new Psr16($cache);
}
/**
* SimplePie to continue to fall back to expired cache, if enabled, when
* feed is unavailable.
*
* This tells SimplePie to ignore any file errors and fall back to cache
* instead. This only works if caching is enabled and cached content
* still exists.
*
* @deprecated since SimplePie 1.8.0, expired cache will not be used anymore.
*
* @param bool $enable Force use of cache on fail.
* @return void
*/
public function force_cache_fallback(bool $enable = false)
{
// @trigger_error(sprintf('SimplePie\SimplePie::force_cache_fallback() is deprecated since SimplePie 1.8.0, expired cache will not be used anymore.'), \E_USER_DEPRECATED);
$this->force_cache_fallback = $enable;
}
/**
* Set the length of time (in seconds) that the contents of a feed will be
* cached
*
* @param int $seconds The feed content cache duration
* @return void
*/
public function set_cache_duration(int $seconds = 3600)
{
$this->cache_duration = $seconds;
}
/**
* Set the length of time (in seconds) that the autodiscovered feed URL will
* be cached
*
* @param int $seconds The autodiscovered feed URL cache duration.
* @return void
*/
public function set_autodiscovery_cache_duration(int $seconds = 604800)
{
$this->autodiscovery_cache_duration = $seconds;
}
/**
* Set the file system location where the cached files should be stored
*
* @deprecated since SimplePie 1.8.0, use SimplePie::set_cache() instead.
*
* @param string $location The file system location.
* @return void
*/
public function set_cache_location(string $location = './cache')
{
// @trigger_error(sprintf('SimplePie\SimplePie::set_cache_location() is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache()" instead.'), \E_USER_DEPRECATED);
$this->cache_location = $location;
}
/**
* Return the filename (i.e. hash, without path and without extension) of the file to cache a given URL.
*
* @param string $url The URL of the feed to be cached.
* @return string A filename (i.e. hash, without path and without extension).
*/
public function get_cache_filename(string $url)
{
// Append custom parameters to the URL to avoid cache pollution in case of multiple calls with different parameters.
$url .= $this->force_feed ? '#force_feed' : '';
$options = [];
if ($this->timeout != 10) {
$options[CURLOPT_TIMEOUT] = $this->timeout;
}
if ($this->useragent !== Misc::get_default_useragent()) {
$options[CURLOPT_USERAGENT] = $this->useragent;
}
if (!empty($this->curl_options)) {
foreach ($this->curl_options as $k => $v) {
$options[$k] = $v;
}
}
if (!empty($options)) {
ksort($options);
$url .= '#' . urlencode(var_export($options, true));
}
return $this->cache_namefilter->filter($url);
}
/**
* Set whether feed items should be sorted into reverse chronological order
*
* @param bool $enable Sort as reverse chronological order.
* @return void
*/
public function enable_order_by_date(bool $enable = true)
{
$this->order_by_date = $enable;
}
/**
* Set the character encoding used to parse the feed
*
* This overrides the encoding reported by the feed, however it will fall
* back to the normal encoding detection if the override fails
*
* @param string|false $encoding Character encoding
* @return void
*/
public function set_input_encoding($encoding = false)
{
if ($encoding) {
$this->input_encoding = (string) $encoding;
} else {
$this->input_encoding = false;
}
}
/**
* Set how much feed autodiscovery to do
*
* @see self::LOCATOR_NONE
* @see self::LOCATOR_AUTODISCOVERY
* @see self::LOCATOR_LOCAL_EXTENSION
* @see self::LOCATOR_LOCAL_BODY
* @see self::LOCATOR_REMOTE_EXTENSION
* @see self::LOCATOR_REMOTE_BODY
* @see self::LOCATOR_ALL
* @param self::LOCATOR_* $level Feed Autodiscovery Level (level can be a combination of the above constants, see bitwise OR operator)
* @return void
*/
public function set_autodiscovery_level(int $level = self::LOCATOR_ALL)
{
$this->autodiscovery = $level;
}
/**
* Get the class registry
*
* Use this to override SimplePie's default classes
*
* @return Registry
*/
public function &get_registry()
{
return $this->registry;
}
/**
* Set which class SimplePie uses for caching
*
* @deprecated since SimplePie 1.3, use {@see set_cache()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_cache_class(string $class = Cache::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::set_cache()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Cache::class, $class, true);
}
/**
* Set which class SimplePie uses for auto-discovery
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_locator_class(string $class = Locator::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Locator::class, $class, true);
}
/**
* Set which class SimplePie uses for XML parsing
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_parser_class(string $class = Parser::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Parser::class, $class, true);
}
/**
* Set which class SimplePie uses for remote file fetching
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_file_class(string $class = File::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(File::class, $class, true);
}
/**
* Set which class SimplePie uses for data sanitization
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_sanitize_class(string $class = Sanitize::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Sanitize::class, $class, true);
}
/**
* Set which class SimplePie uses for handling feed items
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_item_class(string $class = Item::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Item::class, $class, true);
}
/**
* Set which class SimplePie uses for handling author data
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_author_class(string $class = Author::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Author::class, $class, true);
}
/**
* Set which class SimplePie uses for handling category data
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_category_class(string $class = Category::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Category::class, $class, true);
}
/**
* Set which class SimplePie uses for feed enclosures
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_enclosure_class(string $class = Enclosure::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Enclosure::class, $class, true);
}
/**
* Set which class SimplePie uses for `` captions
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string
$class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_caption_class(string $class = Caption::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Caption::class, $class, true);
}
/**
* Set which class SimplePie uses for ``
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_copyright_class(string $class = Copyright::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Copyright::class, $class, true);
}
/**
* Set which class SimplePie uses for ``
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_credit_class(string $class = Credit::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Credit::class, $class, true);
}
/**
* Set which class SimplePie uses for ``
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_rating_class(string $class = Rating::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Rating::class, $class, true);
}
/**
* Set which class SimplePie uses for ``
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_restriction_class(string $class = Restriction::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Restriction::class, $class, true);
}
/**
* Set which class SimplePie uses for content-type sniffing
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_content_type_sniffer_class(string $class = Sniffer::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Sniffer::class, $class, true);
}
/**
* Set which class SimplePie uses item sources
*
* @deprecated since SimplePie 1.3, use {@see get_registry()} instead
*
* @param class-string $class Name of custom class
*
* @return bool True on success, false otherwise
*/
public function set_source_class(string $class = Source::class)
{
trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.3, please use "SimplePie\SimplePie::get_registry()" instead.', __METHOD__), \E_USER_DEPRECATED);
return $this->registry->register(Source::class, $class, true);
}
/**
* Set the user agent string
*
* @param string $ua New user agent string.
* @return void
*/
public function set_useragent(?string $ua = null)
{
if ($this->http_client_injected) {
throw new SimplePieException(sprintf(
'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure user agent string in your HTTP client instead.',
__METHOD__,
self::class
));
}
if ($ua === null) {
$ua = Misc::get_default_useragent();
}
$this->useragent = (string) $ua;
// Reset a possible existing FileClient,
// so a new client with the changed value will be created
if (is_object($this->http_client) && $this->http_client instanceof FileClient) {
$this->http_client = null;
} elseif (is_object($this->http_client)) {
// Trigger notice if a PSR-18 client was set
trigger_error(sprintf(
'Using "%s()" has no effect, because you already provided a HTTP client with "%s::set_http_client()". Configure the useragent in your HTTP client instead.',
__METHOD__,
get_class($this)
), \E_USER_NOTICE);
}
}
/**
* Set a namefilter to modify the cache filename with
*
* @param NameFilter $filter
*
* @return void
*/
public function set_cache_namefilter(NameFilter $filter): void
{
$this->cache_namefilter = $filter;
}
/**
* Set callback function to create cache filename with
*
* @deprecated since SimplePie 1.8.0, use {@see set_cache_namefilter()} instead
*
* @param (string&(callable(string): string))|null $function Callback function
* @return void
*/
public function set_cache_name_function(?string $function = null)
{
// trigger_error(sprintf('"%s()" is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache_namefilter()" instead.', __METHOD__), \E_USER_DEPRECATED);
if ($function === null) {
$function = 'md5';
}
$this->cache_name_function = $function;
$this->set_cache_namefilter(new CallableNameFilter($this->cache_name_function));
}
/**
* Set options to make SP as fast as possible
*
* Forgoes a substantial amount of data sanitization in favor of speed. This
* turns SimplePie into a dumb parser of feeds.
*
* @param bool $set Whether to set them or not
* @return void
*/
public function set_stupidly_fast(bool $set = false)
{
if ($set) {
$this->enable_order_by_date(false);
$this->remove_div(false);
$this->strip_comments(false);
$this->strip_htmltags([]);
$this->strip_attributes([]);
$this->add_attributes([]);
$this->set_image_handler(false);
$this->set_https_domains([]);
}
}
/**
* Set maximum number of feeds to check with autodiscovery
*
* @param int $max Maximum number of feeds to check
* @return void
*/
public function set_max_checked_feeds(int $max = 10)
{
$this->max_checked_feeds = $max;
}
/**
* @return void
*/
public function remove_div(bool $enable = true)
{
$this->sanitize->remove_div($enable);
}
/**
* @param string[]|string|false $tags Set a list of tags to strip, or set empty string to use default tags, or false to strip nothing.
* @return void
*/
public function strip_htmltags($tags = '', ?bool $encode = null)
{
if ($tags === '') {
$tags = $this->strip_htmltags;
}
$this->sanitize->strip_htmltags($tags);
if ($encode !== null) {
$this->sanitize->encode_instead_of_strip($encode);
}
}
/**
* @return void
*/
public function encode_instead_of_strip(bool $enable = true)
{
$this->sanitize->encode_instead_of_strip($enable);
}
/**
* @param string[]|string $attribs
* @return void
*/
public function rename_attributes($attribs = '')
{
if ($attribs === '') {
$attribs = $this->rename_attributes;
}
$this->sanitize->rename_attributes($attribs);
}
/**
* @param string[]|string $attribs
* @return void
*/
public function strip_attributes($attribs = '')
{
if ($attribs === '') {
$attribs = $this->strip_attributes;
}
$this->sanitize->strip_attributes($attribs);
}
/**
* @param array>|'' $attribs
* @return void
*/
public function add_attributes($attribs = '')
{
if ($attribs === '') {
$attribs = $this->add_attributes;
}
$this->sanitize->add_attributes($attribs);
}
/**
* Set the output encoding
*
* Allows you to override SimplePie's output to match that of your webpage.
* This is useful for times when your webpages are not being served as
* UTF-8. This setting will be obeyed by {@see handle_content_type()}, and
* is similar to {@see set_input_encoding()}.
*
* It should be noted, however, that not all character encodings can support
* all characters. If your page is being served as ISO-8859-1 and you try
* to display a Japanese feed, you'll likely see garbled characters.
* Because of this, it is highly recommended to ensure that your webpages
* are served as UTF-8.
*
* The number of supported character encodings depends on whether your web
* host supports {@link http://php.net/mbstring mbstring},
* {@link http://php.net/iconv iconv}, or both. See
* {@link http://simplepie.org/wiki/faq/Supported_Character_Encodings} for
* more information.
*
* @param string $encoding
* @return void
*/
public function set_output_encoding(string $encoding = 'UTF-8')
{
$this->sanitize->set_output_encoding($encoding);
}
/**
* @return void
*/
public function strip_comments(bool $strip = false)
{
$this->sanitize->strip_comments($strip);
}
/**
* Set element/attribute key/value pairs of HTML attributes
* containing URLs that need to be resolved relative to the feed
*
* Defaults to |a|@href, |area|@href, |blockquote|@cite, |del|@cite,
* |form|@action, |img|@longdesc, |img|@src, |input|@src, |ins|@cite,
* |q|@cite
*
* @since 1.0
* @param array|null $element_attribute Element/attribute key/value pairs, null for default
* @return void
*/
public function set_url_replacements(?array $element_attribute = null)
{
$this->sanitize->set_url_replacements($element_attribute);
}
/**
* Set the list of domains for which to force HTTPS.
* @see Sanitize::set_https_domains()
* @param array $domains List of HTTPS domains. Example array('biz', 'example.com', 'example.org', 'www.example.net').
* @return void
*/
public function set_https_domains(array $domains = [])
{
$this->sanitize->set_https_domains($domains);
}
/**
* Set the handler to enable the display of cached images.
*
* @param string|false $page Web-accessible path to the handler_image.php file.
* @param string $qs The query string that the value should be passed to.
* @return void
*/
public function set_image_handler($page = false, string $qs = 'i')
{
if ($page !== false) {
$this->sanitize->set_image_handler($page . '?' . $qs . '=');
} else {
$this->image_handler = '';
}
}
/**
* Set the limit for items returned per-feed with multifeeds
*
* @param int $limit The maximum number of items to return.
* @return void
*/
public function set_item_limit(int $limit = 0)
{
$this->item_limit = $limit;
}
/**
* Enable throwing exceptions
*
* @param bool $enable Should we throw exceptions, or use the old-style error property?
* @return void
*/
public function enable_exceptions(bool $enable = true)
{
$this->enable_exceptions = $enable;
}
/**
* Initialize the feed object
*
* This is what makes everything happen. Period. This is where all of the
* configuration options get processed, feeds are fetched, cached, and
* parsed, and all of that other good stuff.
*
* @return bool True if successful, false otherwise
*/
public function init()
{
// Check absolute bare minimum requirements.
if (!extension_loaded('xml') || !extension_loaded('pcre')) {
$this->error = 'XML or PCRE extensions not loaded!';
return false;
}
// Then check the xml extension is sane (i.e., libxml 2.7.x issue on PHP < 5.2.9 and libxml 2.7.0 to 2.7.2 on any version) if we don't have xmlreader.
elseif (!extension_loaded('xmlreader')) {
static $xml_is_sane = null;
if ($xml_is_sane === null) {
$parser_check = xml_parser_create();
xml_parse_into_struct($parser_check, '&', $values);
if (\PHP_VERSION_ID < 80000) {
xml_parser_free($parser_check);
}
$xml_is_sane = isset($values[0]['value']);
}
if (!$xml_is_sane) {
return false;
}
}
// The default sanitize class gets set in the constructor, check if it has
// changed.
if ($this->registry->get_class(Sanitize::class) !== Sanitize::class) {
$this->sanitize = $this->registry->create(Sanitize::class);
}
if (method_exists($this->sanitize, 'set_registry')) {
$this->sanitize->set_registry($this->registry);
}
// Pass whatever was set with config options over to the sanitizer.
// Pass the classes in for legacy support; new classes should use the registry instead
$cache = $this->registry->get_class(Cache::class);
\assert($cache !== null, 'Cache must be defined');
$this->sanitize->pass_cache_data(
$this->enable_cache,
$this->cache_location,
$this->cache_namefilter,
$cache,
$this->cache
);
$http_client = $this->get_http_client();
if ($http_client instanceof Psr18Client) {
$this->sanitize->set_http_client(
$http_client->getHttpClient(),
$http_client->getRequestFactory(),
$http_client->getUriFactory()
);
}
if (!empty($this->multifeed_url)) {
$i = 0;
$success = 0;
$this->multifeed_objects = [];
$this->error = [];
foreach ($this->multifeed_url as $url) {
$this->multifeed_objects[$i] = clone $this;
$this->multifeed_objects[$i]->set_feed_url($url);
$single_success = $this->multifeed_objects[$i]->init();
$success |= $single_success;
if (!$single_success) {
$this->error[$i] = $this->multifeed_objects[$i]->error();
}
$i++;
}
return (bool) $success;
} elseif ($this->feed_url === null && $this->raw_data === null) {
return false;
}
$this->error = null;
$this->data = [];
$this->check_modified = false;
$this->multifeed_objects = [];
$cache = false;
if ($this->feed_url !== null) {
$parsed_feed_url = $this->registry->call(Misc::class, 'parse_url', [$this->feed_url]);
// Decide whether to enable caching
if ($this->enable_cache && $parsed_feed_url['scheme'] !== '') {
$cache = $this->get_cache($this->feed_url);
}
// Fetch the data into $this->raw_data
if (($fetched = $this->fetch_data($cache)) === true) {
return true;
} elseif ($fetched === false) {
return false;
}
[$headers, $sniffed] = $fetched;
}
// Empty response check
if (empty($this->raw_data)) {
$this->error = "A feed could not be found at `$this->feed_url`. Empty body.";
$this->registry->call(Misc::class, 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]);
return false;
}
// Set up array of possible encodings
$encodings = [];
// First check to see if input has been overridden.
if ($this->input_encoding !== false) {
$encodings[] = strtoupper($this->input_encoding);
}
$application_types = ['application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity'];
$text_types = ['text/xml', 'text/xml-external-parsed-entity'];
// RFC 3023 (only applies to sniffed content)
if (isset($sniffed)) {
if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml') {
if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) {
$encodings[] = strtoupper($charset[1]);
}
$encodings = array_merge($encodings, $this->registry->call(Misc::class, 'xml_encoding', [$this->raw_data, &$this->registry]));
$encodings[] = 'UTF-8';
} elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml') {
if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset)) {
$encodings[] = strtoupper($charset[1]);
}
$encodings[] = 'US-ASCII';
}
// Text MIME-type default
elseif (substr($sniffed, 0, 5) === 'text/') {
$encodings[] = 'UTF-8';
}
}
// Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1
$encodings = array_merge($encodings, $this->registry->call(Misc::class, 'xml_encoding', [$this->raw_data, &$this->registry]));
$encodings[] = 'UTF-8';
$encodings[] = 'ISO-8859-1';
// There's no point in trying an encoding twice
$encodings = array_unique($encodings);
// Loop through each possible encoding, till we return something, or run out of possibilities
foreach ($encodings as $encoding) {
// Change the encoding to UTF-8 (as we always use UTF-8 internally)
if ($utf8_data = $this->registry->call(Misc::class, 'change_encoding', [$this->raw_data, $encoding, 'UTF-8'])) {
// Create new parser
$parser = $this->registry->create(Parser::class);
// If it's parsed fine
if ($parser->parse($utf8_data, 'UTF-8', $this->permanent_url ?? '')) {
$this->data = $parser->get_data();
if (!($this->get_type() & ~self::TYPE_NONE)) {
$this->error = "A feed could not be found at `$this->feed_url`. This does not appear to be a valid RSS or Atom feed.";
$this->registry->call(Misc::class, 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]);
return false;
}
if (isset($headers)) {
$this->data['headers'] = $headers;
}
$this->data['build'] = Misc::get_build();
// Cache the file if caching is enabled
$this->data['cache_expiration_time'] = $this->cache_duration + time();
if ($cache && !$cache->set_data($this->get_cache_filename($this->feed_url), $this->data, $this->cache_duration)) {
trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
}
return true;
}
}
}
if (isset($parser)) {
// We have an error, just set Misc::error to it and quit
$this->error = $this->feed_url;
$this->error .= sprintf(' is invalid XML, likely due to invalid characters. XML error: %s at line %d, column %d', $parser->get_error_string(), $parser->get_current_line(), $parser->get_current_column());
} else {
$this->error = 'The data could not be converted to UTF-8.';
if (!extension_loaded('mbstring') && !extension_loaded('iconv') && !class_exists('\UConverter')) {
$this->error .= ' You MUST have either the iconv, mbstring or intl (PHP 5.5+) extension installed and enabled.';
} else {
$missingExtensions = [];
if (!extension_loaded('iconv')) {
$missingExtensions[] = 'iconv';
}
if (!extension_loaded('mbstring')) {
$missingExtensions[] = 'mbstring';
}
if (!class_exists('\UConverter')) {
$missingExtensions[] = 'intl (PHP 5.5+)';
}
$this->error .= ' Try installing/enabling the ' . implode(' or ', $missingExtensions) . ' extension.';
}
}
$this->registry->call(Misc::class, 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]);
return false;
}
/**
* Fetch the data
*
* If the data is already cached, attempt to fetch it from there instead
*
* @param Base|DataCache|false $cache Cache handler, or false to not load from the cache
* @return array{array, string}|bool Returns true if the data was loaded from the cache, or an array of HTTP headers and sniffed type
*/
protected function fetch_data(&$cache)
{
if ($cache instanceof Base) {
// @trigger_error(sprintf('Providing $cache as "\SimplePie\Cache\Base" in %s() is deprecated since SimplePie 1.8.0, please provide "\SimplePie\Cache\DataCache" implementation instead.', __METHOD__), \E_USER_DEPRECATED);
$cache = new BaseDataCache($cache);
}
// @phpstan-ignore-next-line Enforce PHPDoc type.
if ($cache !== false && !$cache instanceof DataCache) {
throw new InvalidArgumentException(sprintf(
'%s(): Argument #1 ($cache) must be of type %s|false',
__METHOD__,
DataCache::class
), 1);
}
$cacheKey = $this->get_cache_filename($this->feed_url);
// If it's enabled, use the cache
if ($cache) {
// Load the Cache
$this->data = $cache->get_data($cacheKey, []);
if (!empty($this->data)) {
// If the cache is for an outdated build of SimplePie
if (!isset($this->data['build']) || $this->data['build'] !== Misc::get_build()) {
$cache->delete_data($cacheKey);
$this->data = [];
}
// If we've hit a collision just rerun it with caching disabled
elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url) {
$cache = false;
$this->data = [];
}
// If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL.
elseif (isset($this->data['feed_url'])) {
// Do not need to do feed autodiscovery yet.
if ($this->data['feed_url'] !== $this->data['url']) {
$this->set_feed_url($this->data['feed_url']);
$this->data['url'] = $this->data['feed_url'];
$cache->set_data($this->get_cache_filename($this->feed_url), $this->data, $this->autodiscovery_cache_duration);
return $this->init();
}
$cache->delete_data($this->get_cache_filename($this->feed_url));
$this->data = [];
}
// Check if the cache has been updated
elseif (!isset($this->data['cache_expiration_time']) || $this->data['cache_expiration_time'] < time()) {
// Want to know if we tried to send last-modified and/or etag headers
// when requesting this file. (Note that it's up to the file to
// support this, but we don't always send the headers either.)
$this->check_modified = true;
if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) {
$headers = [
'Accept' => SimplePie::DEFAULT_HTTP_ACCEPT_HEADER,
];
if (isset($this->data['headers']['last-modified'])) {
$headers['if-modified-since'] = $this->data['headers']['last-modified'];
}
if (isset($this->data['headers']['etag'])) {
$headers['if-none-match'] = $this->data['headers']['etag'];
}
try {
$file = $this->get_http_client()->request(Client::METHOD_GET, $this->feed_url, $headers);
$this->status_code = $file->get_status_code();
} catch (ClientException $th) {
$this->check_modified = false;
$this->status_code = 0;
if ($this->force_cache_fallback) {
$this->data['cache_expiration_time'] = $this->cache_duration + time();
$cache->set_data($cacheKey, $this->data, $this->cache_duration);
return true;
}
$failedFileReason = $th->getMessage();
}
if ($this->status_code === 304) {
// Set raw_data to false here too, to signify that the cache
// is still valid.
$this->raw_data = false;
$this->data['cache_expiration_time'] = $this->cache_duration + time();
$cache->set_data($cacheKey, $this->data, $this->cache_duration);
return true;
}
}
}
// If the cache is still valid, just return true
else {
$this->raw_data = false;
return true;
}
}
// If the cache is empty
else {
$this->data = [];
}
}
// If we don't already have the file (it'll only exist if we've opened it to check if the cache has been modified), open it.
if (!isset($file)) {
if ($this->file instanceof File && $this->file->get_final_requested_uri() === $this->feed_url) {
$file = &$this->file;
} elseif (isset($failedFileReason)) {
// Do not try to fetch again if we already failed once.
// If the file connection had an error, set SimplePie::error to that and quit
$this->error = $failedFileReason;
return !empty($this->data);
} else {
$headers = [
'Accept' => SimplePie::DEFAULT_HTTP_ACCEPT_HEADER,
];
try {
$file = $this->get_http_client()->request(Client::METHOD_GET, $this->feed_url, $headers);
} catch (ClientException $th) {
// If the file connection has an error, set SimplePie::error to that and quit
$this->error = $th->getMessage();
return !empty($this->data);
}
}
}
$this->status_code = $file->get_status_code();
// If the file connection has an error, set SimplePie::error to that and quit
if (!(!Misc::is_remote_uri($file->get_final_requested_uri()) || ($file->get_status_code() === 200 || $file->get_status_code() > 206 && $file->get_status_code() < 300))) {
$this->error = 'Retrieved unsupported status code "' . $this->status_code . '"';
return !empty($this->data);
}
if (!$this->force_feed) {
// Check if the supplied URL is a feed, if it isn't, look for it.
$locate = $this->registry->create(Locator::class, [
(!$file instanceof File) ? File::fromResponse($file) : $file,
$this->timeout,
$this->useragent,
$this->max_checked_feeds,
$this->force_fsockopen,
$this->curl_options
]);
$http_client = $this->get_http_client();
if ($http_client instanceof Psr18Client) {
$locate->set_http_client(
$http_client->getHttpClient(),
$http_client->getRequestFactory(),
$http_client->getUriFactory()
);
}
if (!$locate->is_feed($file)) {
$copyStatusCode = $file->get_status_code();
$copyContentType = $file->get_header_line('content-type');
try {
$microformats = false;
if (class_exists('DOMXpath') && function_exists('Mf2\parse')) {
$doc = new \DOMDocument();
@$doc->loadHTML($file->get_body_content());
$xpath = new \DOMXpath($doc);
// Check for both h-feed and h-entry, as both a feed with no entries
// and a list of entries without an h-feed wrapper are both valid.
$query = '//*[contains(concat(" ", @class, " "), " h-feed ") or '.
'contains(concat(" ", @class, " "), " h-entry ")]';
/** @var \DOMNodeList<\DOMElement> $result */
$result = $xpath->query($query);
$microformats = $result->length !== 0;
}
// Now also do feed discovery, but if microformats were found don't
// overwrite the current value of file.
$discovered = $locate->find(
$this->autodiscovery,
$this->all_discovered_feeds
);
if ($microformats) {
$hub = $locate->get_rel_link('hub');
$self = $locate->get_rel_link('self');
if ($hub || $self) {
$file = $this->store_links($file, $hub, $self);
}
// Push the current file onto all_discovered feeds so the user can
// be shown this as one of the options.
if ($this->all_discovered_feeds !== null) {
$this->all_discovered_feeds[] = $file;
}
} else {
if ($discovered) {
$file = $discovered;
} else {
// We need to unset this so that if SimplePie::set_file() has
// been called that object is untouched
unset($file);
$this->error = "A feed could not be found at `$this->feed_url`; the status code is `$copyStatusCode` and content-type is `$copyContentType`";
$this->registry->call(Misc::class, 'error', [$this->error, E_USER_NOTICE, __FILE__, __LINE__]);
return false;
}
}
} catch (SimplePieException $e) {
// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
unset($file);
// This is usually because DOMDocument doesn't exist
$this->error = $e->getMessage();
$this->registry->call(Misc::class, 'error', [$this->error, E_USER_NOTICE, $e->getFile(), $e->getLine()]);
return false;
}
if ($cache) {
$this->data = [
'url' => $this->feed_url,
'feed_url' => $file->get_final_requested_uri(),
'build' => Misc::get_build(),
'cache_expiration_time' => $this->cache_duration + time(),
];
if (!$cache->set_data($cacheKey, $this->data, $this->cache_duration)) {
trigger_error("$this->cache_location is not writable. Make sure you've set the correct relative or absolute path, and that the location is server-writable.", E_USER_WARNING);
}
}
}
$this->feed_url = $file->get_final_requested_uri();
$locate = null;
}
$this->raw_data = $file->get_body_content();
$this->permanent_url = $file->get_permanent_uri();
$headers = [];
foreach ($file->get_headers() as $key => $values) {
$headers[$key] = implode(', ', $values);
}
$sniffer = $this->registry->create(Sniffer::class, [&$file]);
$sniffed = $sniffer->get_type();
return [$headers, $sniffed];
}
/**
* Get the error message for the occurred error
*
* @return string|string[]|null Error message, or array of messages for multifeeds
*/
public function error()
{
return $this->error;
}
/**
* Get the last HTTP status code
*
* @return int Status code
*/
public function status_code()
{
return $this->status_code;
}
/**
* Get the raw XML
*
* This is the same as the old `$feed->enable_xml_dump(true)`, but returns
* the data instead of printing it.
*
* @return string|false Raw XML data, false if the cache is used
*/
public function get_raw_data()
{
return $this->raw_data;
}
/**
* Get the character encoding used for output
*
* @since Preview Release
* @return string
*/
public function get_encoding()
{
return $this->sanitize->output_encoding;
}
/**
* Send the content-type header with correct encoding
*
* This method ensures that the SimplePie-enabled page is being served with
* the correct {@link http://www.iana.org/assignments/media-types/ mime-type}
* and character encoding HTTP headers (character encoding determined by the
* {@see set_output_encoding} config option).
*
* This won't work properly if any content or whitespace has already been
* sent to the browser, because it relies on PHP's
* {@link http://php.net/header header()} function, and these are the
* circumstances under which the function works.
*
* Because it's setting these settings for the entire page (as is the nature
* of HTTP headers), this should only be used once per page (again, at the
* top).
*
* @param string $mime MIME type to serve the page as
* @return void
*/
public function handle_content_type(string $mime = 'text/html')
{
if (!headers_sent()) {
$header = "Content-type: $mime;";
if ($this->get_encoding()) {
$header .= ' charset=' . $this->get_encoding();
} else {
$header .= ' charset=UTF-8';
}
header($header);
}
}
/**
* Get the type of the feed
*
* This returns a self::TYPE_* constant, which can be tested against
* using {@link http://php.net/language.operators.bitwise bitwise operators}
*
* @since 0.8 (usage changed to using constants in 1.0)
* @see self::TYPE_NONE Unknown.
* @see self::TYPE_RSS_090 RSS 0.90.
* @see self::TYPE_RSS_091_NETSCAPE RSS 0.91 (Netscape).
* @see self::TYPE_RSS_091_USERLAND RSS 0.91 (Userland).
* @see self::TYPE_RSS_091 RSS 0.91.
* @see self::TYPE_RSS_092 RSS 0.92.
* @see self::TYPE_RSS_093 RSS 0.93.
* @see self::TYPE_RSS_094 RSS 0.94.
* @see self::TYPE_RSS_10 RSS 1.0.
* @see self::TYPE_RSS_20 RSS 2.0.x.
* @see self::TYPE_RSS_RDF RDF-based RSS.
* @see self::TYPE_RSS_SYNDICATION Non-RDF-based RSS (truly intended as syndication format).
* @see self::TYPE_RSS_ALL Any version of RSS.
* @see self::TYPE_ATOM_03 Atom 0.3.
* @see self::TYPE_ATOM_10 Atom 1.0.
* @see self::TYPE_ATOM_ALL Any version of Atom.
* @see self::TYPE_ALL Any known/supported feed type.
* @return int-mask-of constant
*/
public function get_type()
{
if (!isset($this->data['type'])) {
$this->data['type'] = self::TYPE_ALL;
if (isset($this->data['child'][self::NAMESPACE_ATOM_10]['feed'])) {
$this->data['type'] &= self::TYPE_ATOM_10;
} elseif (isset($this->data['child'][self::NAMESPACE_ATOM_03]['feed'])) {
$this->data['type'] &= self::TYPE_ATOM_03;
} elseif (isset($this->data['child'][self::NAMESPACE_RDF]['RDF'])) {
if (isset($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['child'][self::NAMESPACE_RSS_10]['channel'])
|| isset($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['child'][self::NAMESPACE_RSS_10]['image'])
|| isset($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['child'][self::NAMESPACE_RSS_10]['item'])
|| isset($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['child'][self::NAMESPACE_RSS_10]['textinput'])) {
$this->data['type'] &= self::TYPE_RSS_10;
}
if (isset($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['child'][self::NAMESPACE_RSS_090]['channel'])
|| isset($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['child'][self::NAMESPACE_RSS_090]['image'])
|| isset($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['child'][self::NAMESPACE_RSS_090]['item'])
|| isset($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['child'][self::NAMESPACE_RSS_090]['textinput'])) {
$this->data['type'] &= self::TYPE_RSS_090;
}
} elseif (isset($this->data['child'][self::NAMESPACE_RSS_20]['rss'])) {
$this->data['type'] &= self::TYPE_RSS_ALL;
if (isset($this->data['child'][self::NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) {
switch (trim($this->data['child'][self::NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version'])) {
case '0.91':
$this->data['type'] &= self::TYPE_RSS_091;
if (isset($this->data['child'][self::NAMESPACE_RSS_20]['rss'][0]['child'][self::NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) {
switch (trim($this->data['child'][self::NAMESPACE_RSS_20]['rss'][0]['child'][self::NAMESPACE_RSS_20]['skiphours']['hour'][0]['data'])) {
case '0':
$this->data['type'] &= self::TYPE_RSS_091_NETSCAPE;
break;
case '24':
$this->data['type'] &= self::TYPE_RSS_091_USERLAND;
break;
}
}
break;
case '0.92':
$this->data['type'] &= self::TYPE_RSS_092;
break;
case '0.93':
$this->data['type'] &= self::TYPE_RSS_093;
break;
case '0.94':
$this->data['type'] &= self::TYPE_RSS_094;
break;
case '2.0':
$this->data['type'] &= self::TYPE_RSS_20;
break;
}
}
} else {
$this->data['type'] = self::TYPE_NONE;
}
}
return $this->data['type'];
}
/**
* Get the URL for the feed
*
* When the 'permanent' mode is enabled, returns the original feed URL,
* except in the case of an `HTTP 301 Moved Permanently` status response,
* in which case the location of the first redirection is returned.
*
* When the 'permanent' mode is disabled (default),
* may or may not be different from the URL passed to {@see set_feed_url()},
* depending on whether auto-discovery was used, and whether there were
* any redirects along the way.
*
* @since Preview Release (previously called `get_feed_url()` since SimplePie 0.8.)
* @todo Support
* @todo Also, |atom:link|@rel=self
* @param bool $permanent Permanent mode to return only the original URL or the first redirection
* iff it is a 301 redirection
* @return string|null
*/
public function subscribe_url(bool $permanent = false)
{
if ($permanent) {
if ($this->permanent_url !== null) {
// sanitize encodes ampersands which are required when used in a url.
return str_replace(
'&',
'&',
$this->sanitize(
$this->permanent_url,
self::CONSTRUCT_IRI
)
);
}
} else {
if ($this->feed_url !== null) {
return str_replace(
'&',
'&',
$this->sanitize(
$this->feed_url,
self::CONSTRUCT_IRI
)
);
}
}
return null;
}
/**
* Get data for an feed-level element
*
* This method allows you to get access to ANY element/attribute that is a
* sub-element of the opening feed tag.
*
* The return value is an indexed array of elements matching the given
* namespace and tag name. Each element has `attribs`, `data` and `child`
* subkeys. For `attribs` and `child`, these contain namespace subkeys.
* `attribs` then has one level of associative name => value data (where
* `value` is a string) after the namespace. `child` has tag-indexed keys
* after the namespace, each member of which is an indexed array matching
* this same format.
*
* For example:
*
* // This is probably a bad example because we already support
* // natively, but it shows you how to parse through
* // the nodes.
* $group = $item->get_item_tags(\SimplePie\SimplePie::NAMESPACE_MEDIARSS, 'group');
* $content = $group[0]['child'][\SimplePie\SimplePie::NAMESPACE_MEDIARSS]['content'];
* $file = $content[0]['attribs']['']['url'];
* echo $file;
*
*
* @since 1.0
* @see http://simplepie.org/wiki/faq/supported_xml_namespaces
* @param string $namespace The URL of the XML namespace of the elements you're trying to access
* @param string $tag Tag name
* @return array>|null
*/
public function get_feed_tags(string $namespace, string $tag)
{
$type = $this->get_type();
if ($type & self::TYPE_ATOM_10) {
if (isset($this->data['child'][self::NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag])) {
return $this->data['child'][self::NAMESPACE_ATOM_10]['feed'][0]['child'][$namespace][$tag];
}
}
if ($type & self::TYPE_ATOM_03) {
if (isset($this->data['child'][self::NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag])) {
return $this->data['child'][self::NAMESPACE_ATOM_03]['feed'][0]['child'][$namespace][$tag];
}
}
if ($type & self::TYPE_RSS_RDF) {
if (isset($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag])) {
return $this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['child'][$namespace][$tag];
}
}
if ($type & self::TYPE_RSS_SYNDICATION) {
if (isset($this->data['child'][self::NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag])) {
return $this->data['child'][self::NAMESPACE_RSS_20]['rss'][0]['child'][$namespace][$tag];
}
}
return null;
}
/**
* Get data for an channel-level element
*
* This method allows you to get access to ANY element/attribute in the
* channel/header section of the feed.
*
* See {@see SimplePie::get_feed_tags()} for a description of the return value
*
* @since 1.0
* @see http://simplepie.org/wiki/faq/supported_xml_namespaces
* @param string $namespace The URL of the XML namespace of the elements you're trying to access
* @param string $tag Tag name
* @return array>|null
*/
public function get_channel_tags(string $namespace, string $tag)
{
$type = $this->get_type();
if ($type & self::TYPE_ATOM_ALL) {
if ($return = $this->get_feed_tags($namespace, $tag)) {
return $return;
}
}
if ($type & self::TYPE_RSS_10) {
if ($channel = $this->get_feed_tags(self::NAMESPACE_RSS_10, 'channel')) {
if (isset($channel[0]['child'][$namespace][$tag])) {
return $channel[0]['child'][$namespace][$tag];
}
}
}
if ($type & self::TYPE_RSS_090) {
if ($channel = $this->get_feed_tags(self::NAMESPACE_RSS_090, 'channel')) {
if (isset($channel[0]['child'][$namespace][$tag])) {
return $channel[0]['child'][$namespace][$tag];
}
}
}
if ($type & self::TYPE_RSS_SYNDICATION) {
if ($channel = $this->get_feed_tags(self::NAMESPACE_RSS_20, 'channel')) {
if (isset($channel[0]['child'][$namespace][$tag])) {
return $channel[0]['child'][$namespace][$tag];
}
}
}
return null;
}
/**
* Get data for an channel-level element
*
* This method allows you to get access to ANY element/attribute in the
* image/logo section of the feed.
*
* See {@see SimplePie::get_feed_tags()} for a description of the return value
*
* @since 1.0
* @see http://simplepie.org/wiki/faq/supported_xml_namespaces
* @param string $namespace The URL of the XML namespace of the elements you're trying to access
* @param string $tag Tag name
* @return array>|null
*/
public function get_image_tags(string $namespace, string $tag)
{
$type = $this->get_type();
if ($type & self::TYPE_RSS_10) {
if ($image = $this->get_feed_tags(self::NAMESPACE_RSS_10, 'image')) {
if (isset($image[0]['child'][$namespace][$tag])) {
return $image[0]['child'][$namespace][$tag];
}
}
}
if ($type & self::TYPE_RSS_090) {
if ($image = $this->get_feed_tags(self::NAMESPACE_RSS_090, 'image')) {
if (isset($image[0]['child'][$namespace][$tag])) {
return $image[0]['child'][$namespace][$tag];
}
}
}
if ($type & self::TYPE_RSS_SYNDICATION) {
if ($image = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'image')) {
if (isset($image[0]['child'][$namespace][$tag])) {
return $image[0]['child'][$namespace][$tag];
}
}
}
return null;
}
/**
* Get the base URL value from the feed
*
* Uses `` if available,
* otherwise uses the first 'self' link or the first 'alternate' link of the feed,
* or failing that, the URL of the feed itself.
*
* @see get_link
* @see subscribe_url
*
* @param array $element
* @return string
*/
public function get_base(array $element = [])
{
if (!empty($element['xml_base_explicit']) && isset($element['xml_base'])) {
return $element['xml_base'];
}
if (($link = $this->get_link(0, 'alternate')) !== null) {
return $link;
}
if (($link = $this->get_link(0, 'self')) !== null) {
return $link;
}
return $this->subscribe_url() ?? '';
}
/**
* Sanitize feed data
*
* @access private
* @see Sanitize::sanitize()
* @param string $data Data to sanitize
* @param int-mask-of $type
* @param string $base Base URL to resolve URLs against
* @return string Sanitized data
*/
public function sanitize(string $data, int $type, string $base = '')
{
try {
// This really returns string|false but changing encoding is uncommon and we are going to deprecate it, so let’s just lie to PHPStan in the interest of cleaner annotations.
return $this->sanitize->sanitize($data, $type, $base);
} catch (SimplePieException $e) {
if (!$this->enable_exceptions) {
$this->error = $e->getMessage();
$this->registry->call(Misc::class, 'error', [$this->error, E_USER_WARNING, $e->getFile(), $e->getLine()]);
return '';
}
throw $e;
}
}
/**
* Get the title of the feed
*
* Uses ``, `` or ``
*
* @since 1.0 (previously called `get_feed_title` since 0.8)
* @return string|null
*/
public function get_title()
{
if ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'title')) {
return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'title')) {
return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_10, 'title')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_090, 'title')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'title')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_DC_11, 'title')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_DC_10, 'title')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
}
return null;
}
/**
* Get a category for the feed
*
* @since Unknown
* @param int $key The category that you want to return. Remember that arrays begin with 0, not 1
* @return Category|null
*/
public function get_category(int $key = 0)
{
$categories = $this->get_categories();
if (isset($categories[$key])) {
return $categories[$key];
}
return null;
}
/**
* Get all categories for the feed
*
* Uses ``, `` or ``
*
* @since Unknown
* @return array|null List of {@see Category} objects
*/
public function get_categories()
{
$categories = [];
foreach ((array) $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'category') as $category) {
$term = null;
$scheme = null;
$label = null;
if (isset($category['attribs']['']['term'])) {
$term = $this->sanitize($category['attribs']['']['term'], self::CONSTRUCT_TEXT);
}
if (isset($category['attribs']['']['scheme'])) {
$scheme = $this->sanitize($category['attribs']['']['scheme'], self::CONSTRUCT_TEXT);
}
if (isset($category['attribs']['']['label'])) {
$label = $this->sanitize($category['attribs']['']['label'], self::CONSTRUCT_TEXT);
}
$categories[] = $this->registry->create(Category::class, [$term, $scheme, $label]);
}
foreach ((array) $this->get_channel_tags(self::NAMESPACE_RSS_20, 'category') as $category) {
// This is really the label, but keep this as the term also for BC.
// Label will also work on retrieving because that falls back to term.
$term = $this->sanitize($category['data'], self::CONSTRUCT_TEXT);
if (isset($category['attribs']['']['domain'])) {
$scheme = $this->sanitize($category['attribs']['']['domain'], self::CONSTRUCT_TEXT);
} else {
$scheme = null;
}
$categories[] = $this->registry->create(Category::class, [$term, $scheme, null]);
}
foreach ((array) $this->get_channel_tags(self::NAMESPACE_DC_11, 'subject') as $category) {
$categories[] = $this->registry->create(Category::class, [$this->sanitize($category['data'], self::CONSTRUCT_TEXT), null, null]);
}
foreach ((array) $this->get_channel_tags(self::NAMESPACE_DC_10, 'subject') as $category) {
$categories[] = $this->registry->create(Category::class, [$this->sanitize($category['data'], self::CONSTRUCT_TEXT), null, null]);
}
if (!empty($categories)) {
return array_unique($categories);
}
return null;
}
/**
* Get an author for the feed
*
* @since 1.1
* @param int $key The author that you want to return. Remember that arrays begin with 0, not 1
* @return Author|null
*/
public function get_author(int $key = 0)
{
$authors = $this->get_authors();
if (isset($authors[$key])) {
return $authors[$key];
}
return null;
}
/**
* Get all authors for the feed
*
* Uses ``, ``, `` or ``
*
* @since 1.1
* @return array|null List of {@see Author} objects
*/
public function get_authors()
{
$authors = [];
foreach ((array) $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'author') as $author) {
$name = null;
$uri = null;
$email = null;
if (isset($author['child'][self::NAMESPACE_ATOM_10]['name'][0]['data'])) {
$name = $this->sanitize($author['child'][self::NAMESPACE_ATOM_10]['name'][0]['data'], self::CONSTRUCT_TEXT);
}
if (isset($author['child'][self::NAMESPACE_ATOM_10]['uri'][0]['data'])) {
$uri = $author['child'][self::NAMESPACE_ATOM_10]['uri'][0];
$uri = $this->sanitize($uri['data'], self::CONSTRUCT_IRI, $this->get_base($uri));
}
if (isset($author['child'][self::NAMESPACE_ATOM_10]['email'][0]['data'])) {
$email = $this->sanitize($author['child'][self::NAMESPACE_ATOM_10]['email'][0]['data'], self::CONSTRUCT_TEXT);
}
if ($name !== null || $email !== null || $uri !== null) {
$authors[] = $this->registry->create(Author::class, [$name, $uri, $email]);
}
}
if ($author = $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'author')) {
$name = null;
$url = null;
$email = null;
if (isset($author[0]['child'][self::NAMESPACE_ATOM_03]['name'][0]['data'])) {
$name = $this->sanitize($author[0]['child'][self::NAMESPACE_ATOM_03]['name'][0]['data'], self::CONSTRUCT_TEXT);
}
if (isset($author[0]['child'][self::NAMESPACE_ATOM_03]['url'][0]['data'])) {
$url = $author[0]['child'][self::NAMESPACE_ATOM_03]['url'][0];
$url = $this->sanitize($url['data'], self::CONSTRUCT_IRI, $this->get_base($url));
}
if (isset($author[0]['child'][self::NAMESPACE_ATOM_03]['email'][0]['data'])) {
$email = $this->sanitize($author[0]['child'][self::NAMESPACE_ATOM_03]['email'][0]['data'], self::CONSTRUCT_TEXT);
}
if ($name !== null || $email !== null || $url !== null) {
$authors[] = $this->registry->create(Author::class, [$name, $url, $email]);
}
}
foreach ((array) $this->get_channel_tags(self::NAMESPACE_DC_11, 'creator') as $author) {
$authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], self::CONSTRUCT_TEXT), null, null]);
}
foreach ((array) $this->get_channel_tags(self::NAMESPACE_DC_10, 'creator') as $author) {
$authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], self::CONSTRUCT_TEXT), null, null]);
}
foreach ((array) $this->get_channel_tags(self::NAMESPACE_ITUNES, 'author') as $author) {
$authors[] = $this->registry->create(Author::class, [$this->sanitize($author['data'], self::CONSTRUCT_TEXT), null, null]);
}
if (!empty($authors)) {
return array_unique($authors);
}
return null;
}
/**
* Get a contributor for the feed
*
* @since 1.1
* @param int $key The contrbutor that you want to return. Remember that arrays begin with 0, not 1
* @return Author|null
*/
public function get_contributor(int $key = 0)
{
$contributors = $this->get_contributors();
if (isset($contributors[$key])) {
return $contributors[$key];
}
return null;
}
/**
* Get all contributors for the feed
*
* Uses ``
*
* @since 1.1
* @return array|null List of {@see Author} objects
*/
public function get_contributors()
{
$contributors = [];
foreach ((array) $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'contributor') as $contributor) {
$name = null;
$uri = null;
$email = null;
if (isset($contributor['child'][self::NAMESPACE_ATOM_10]['name'][0]['data'])) {
$name = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_10]['name'][0]['data'], self::CONSTRUCT_TEXT);
}
if (isset($contributor['child'][self::NAMESPACE_ATOM_10]['uri'][0]['data'])) {
$uri = $contributor['child'][self::NAMESPACE_ATOM_10]['uri'][0];
$uri = $this->sanitize($uri['data'], self::CONSTRUCT_IRI, $this->get_base($uri));
}
if (isset($contributor['child'][self::NAMESPACE_ATOM_10]['email'][0]['data'])) {
$email = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_10]['email'][0]['data'], self::CONSTRUCT_TEXT);
}
if ($name !== null || $email !== null || $uri !== null) {
$contributors[] = $this->registry->create(Author::class, [$name, $uri, $email]);
}
}
foreach ((array) $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'contributor') as $contributor) {
$name = null;
$url = null;
$email = null;
if (isset($contributor['child'][self::NAMESPACE_ATOM_03]['name'][0]['data'])) {
$name = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_03]['name'][0]['data'], self::CONSTRUCT_TEXT);
}
if (isset($contributor['child'][self::NAMESPACE_ATOM_03]['url'][0]['data'])) {
$url = $contributor['child'][self::NAMESPACE_ATOM_03]['url'][0];
$url = $this->sanitize($url['data'], self::CONSTRUCT_IRI, $this->get_base($url));
}
if (isset($contributor['child'][self::NAMESPACE_ATOM_03]['email'][0]['data'])) {
$email = $this->sanitize($contributor['child'][self::NAMESPACE_ATOM_03]['email'][0]['data'], self::CONSTRUCT_TEXT);
}
if ($name !== null || $email !== null || $url !== null) {
$contributors[] = $this->registry->create(Author::class, [$name, $url, $email]);
}
}
if (!empty($contributors)) {
return array_unique($contributors);
}
return null;
}
/**
* Get a single link for the feed
*
* @since 1.0 (previously called `get_feed_link` since Preview Release, `get_feed_permalink()` since 0.8)
* @param int $key The link that you want to return. Remember that arrays begin with 0, not 1
* @param string $rel The relationship of the link to return
* @return string|null Link URL
*/
public function get_link(int $key = 0, string $rel = 'alternate')
{
$links = $this->get_links($rel);
if (isset($links[$key])) {
return $links[$key];
}
return null;
}
/**
* Get the permalink for the item
*
* Returns the first link available with a relationship of "alternate".
* Identical to {@see get_link()} with key 0
*
* @see get_link
* @since 1.0 (previously called `get_feed_link` since Preview Release, `get_feed_permalink()` since 0.8)
* @internal Added for parity between the parent-level and the item/entry-level.
* @return string|null Link URL
*/
public function get_permalink()
{
return $this->get_link(0);
}
/**
* Get all links for the feed
*
* Uses `` or ``
*
* @since Beta 2
* @param string $rel The relationship of links to return
* @return array|null Links found for the feed (strings)
*/
public function get_links(string $rel = 'alternate')
{
if (!isset($this->data['links'])) {
$this->data['links'] = [];
if ($links = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'link')) {
foreach ($links as $link) {
if (isset($link['attribs']['']['href'])) {
$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], self::CONSTRUCT_IRI, $this->get_base($link));
}
}
}
if ($links = $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'link')) {
foreach ($links as $link) {
if (isset($link['attribs']['']['href'])) {
$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], self::CONSTRUCT_IRI, $this->get_base($link));
}
}
}
if ($links = $this->get_channel_tags(self::NAMESPACE_RSS_10, 'link')) {
$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], self::CONSTRUCT_IRI, $this->get_base($links[0]));
}
if ($links = $this->get_channel_tags(self::NAMESPACE_RSS_090, 'link')) {
$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], self::CONSTRUCT_IRI, $this->get_base($links[0]));
}
if ($links = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'link')) {
$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], self::CONSTRUCT_IRI, $this->get_base($links[0]));
}
$keys = array_keys($this->data['links']);
foreach ($keys as $key) {
if ($this->registry->call(Misc::class, 'is_isegment_nz_nc', [$key])) {
if (isset($this->data['links'][self::IANA_LINK_RELATIONS_REGISTRY . $key])) {
$this->data['links'][self::IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][self::IANA_LINK_RELATIONS_REGISTRY . $key]);
$this->data['links'][$key] = &$this->data['links'][self::IANA_LINK_RELATIONS_REGISTRY . $key];
} else {
$this->data['links'][self::IANA_LINK_RELATIONS_REGISTRY . $key] = &$this->data['links'][$key];
}
} elseif (substr($key, 0, 41) === self::IANA_LINK_RELATIONS_REGISTRY) {
$this->data['links'][substr($key, 41)] = &$this->data['links'][$key];
}
$this->data['links'][$key] = array_unique($this->data['links'][$key]);
}
}
if (isset($this->data['headers']['link'])) {
$link_headers = $this->data['headers']['link'];
if (is_array($link_headers)) {
$link_headers = implode(',', $link_headers);
}
// https://datatracker.ietf.org/doc/html/rfc8288
if (is_string($link_headers) &&
preg_match_all('/<(?P[^>]+)>\s*;\s*rel\s*=\s*(?P"?)' . preg_quote($rel) . '(?P=quote)\s*(?=,|$)/i', $link_headers, $matches)) {
return $matches['uri'];
}
}
if (isset($this->data['links'][$rel])) {
return $this->data['links'][$rel];
}
return null;
}
/**
* @return ?array
*/
public function get_all_discovered_feeds()
{
return $this->all_discovered_feeds;
}
/**
* Get the content for the item
*
* Uses ``, ``, ``,
* ``, `` or ``
*
* @since 1.0 (previously called `get_feed_description()` since 0.8)
* @return string|null
*/
public function get_description()
{
if ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'subtitle')) {
return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'tagline')) {
return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_10, 'description')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_090, 'description')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'description')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_HTML, $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_DC_11, 'description')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_DC_10, 'description')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_ITUNES, 'summary')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_HTML, $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_ITUNES, 'subtitle')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_HTML, $this->get_base($return[0]));
}
return null;
}
/**
* Get the copyright info for the feed
*
* Uses ``, `` or ``
*
* @since 1.0 (previously called `get_feed_copyright()` since 0.8)
* @return string|null
*/
public function get_copyright()
{
if ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'rights')) {
return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_10_construct_type', [$return[0]['attribs']]), $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_03, 'copyright')) {
return $this->sanitize($return[0]['data'], $this->registry->call(Misc::class, 'atom_03_construct_type', [$return[0]['attribs']]), $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'copyright')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_DC_11, 'rights')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_DC_10, 'rights')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
}
return null;
}
/**
* Get the language for the feed
*
* Uses ``, ``, or @xml_lang
*
* @since 1.0 (previously called `get_feed_language()` since 0.8)
* @return string|null
*/
public function get_language()
{
if ($return = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'language')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_DC_11, 'language')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_DC_10, 'language')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif (isset($this->data['child'][self::NAMESPACE_ATOM_10]['feed'][0]['xml_lang'])) {
return $this->sanitize($this->data['child'][self::NAMESPACE_ATOM_10]['feed'][0]['xml_lang'], self::CONSTRUCT_TEXT);
} elseif (isset($this->data['child'][self::NAMESPACE_ATOM_03]['feed'][0]['xml_lang'])) {
return $this->sanitize($this->data['child'][self::NAMESPACE_ATOM_03]['feed'][0]['xml_lang'], self::CONSTRUCT_TEXT);
} elseif (isset($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['xml_lang'])) {
return $this->sanitize($this->data['child'][self::NAMESPACE_RDF]['RDF'][0]['xml_lang'], self::CONSTRUCT_TEXT);
} elseif (isset($this->data['headers']['content-language'])) {
return $this->sanitize($this->data['headers']['content-language'], self::CONSTRUCT_TEXT);
}
return null;
}
/**
* Get the latitude coordinates for the item
*
* Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications
*
* Uses `` or ``
*
* @since 1.0
* @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
* @link http://www.georss.org/ GeoRSS
* @return float|null
*/
public function get_latitude()
{
if ($return = $this->get_channel_tags(self::NAMESPACE_W3C_BASIC_GEO, 'lat')) {
return (float) $return[0]['data'];
} elseif (($return = $this->get_channel_tags(self::NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) {
return (float) $match[1];
}
return null;
}
/**
* Get the longitude coordinates for the feed
*
* Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications
*
* Uses ``, `` or ``
*
* @since 1.0
* @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
* @link http://www.georss.org/ GeoRSS
* @return float|null
*/
public function get_longitude()
{
if ($return = $this->get_channel_tags(self::NAMESPACE_W3C_BASIC_GEO, 'long')) {
return (float) $return[0]['data'];
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_W3C_BASIC_GEO, 'lon')) {
return (float) $return[0]['data'];
} elseif (($return = $this->get_channel_tags(self::NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match)) {
return (float) $match[2];
}
return null;
}
/**
* Get the feed logo's title
*
* RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" title.
*
* Uses `` or ``
*
* @return string|null
*/
public function get_image_title()
{
if ($return = $this->get_image_tags(self::NAMESPACE_RSS_10, 'title')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_090, 'title')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'title')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_image_tags(self::NAMESPACE_DC_11, 'title')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
} elseif ($return = $this->get_image_tags(self::NAMESPACE_DC_10, 'title')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_TEXT);
}
return null;
}
/**
* Get the feed logo's URL
*
* RSS 0.9.0, 2.0, Atom 1.0, and feeds with iTunes RSS tags are allowed to
* have a "feed logo" URL. This points directly to the image itself.
*
* Uses ``, ``, ``,
* `` or ``
*
* @return string|null
*/
public function get_image_url()
{
if ($return = $this->get_channel_tags(self::NAMESPACE_ITUNES, 'image')) {
return $this->sanitize($return[0]['attribs']['']['href'], self::CONSTRUCT_IRI);
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'logo')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
} elseif ($return = $this->get_channel_tags(self::NAMESPACE_ATOM_10, 'icon')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_10, 'url')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_090, 'url')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'url')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
}
return null;
}
/**
* Get the feed logo's link
*
* RSS 0.9.0, 1.0 and 2.0 feeds are allowed to have a "feed logo" link. This
* points to a human-readable page that the image should link to.
*
* Uses ``, ``, ``,
* `` or ``
*
* @return string|null
*/
public function get_image_link()
{
if ($return = $this->get_image_tags(self::NAMESPACE_RSS_10, 'link')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_090, 'link')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
} elseif ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'link')) {
return $this->sanitize($return[0]['data'], self::CONSTRUCT_IRI, $this->get_base($return[0]));
}
return null;
}
/**
* Get the feed logo's link
*
* RSS 2.0 feeds are allowed to have a "feed logo" width.
*
* Uses `` or defaults to 88 if no width is specified and
* the feed is an RSS 2.0 feed.
*
* @return int|null
*/
public function get_image_width()
{
if ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'width')) {
return intval($return[0]['data']);
} elseif ($this->get_type() & self::TYPE_RSS_SYNDICATION && $this->get_image_tags(self::NAMESPACE_RSS_20, 'url')) {
return 88;
}
return null;
}
/**
* Get the feed logo's height
*
* RSS 2.0 feeds are allowed to have a "feed logo" height.
*
* Uses `` or defaults to 31 if no height is specified and
* the feed is an RSS 2.0 feed.
*
* @return int|null
*/
public function get_image_height()
{
if ($return = $this->get_image_tags(self::NAMESPACE_RSS_20, 'height')) {
return intval($return[0]['data']);
} elseif ($this->get_type() & self::TYPE_RSS_SYNDICATION && $this->get_image_tags(self::NAMESPACE_RSS_20, 'url')) {
return 31;
}
return null;
}
/**
* Get the number of items in the feed
*
* This is well-suited for {@link http://php.net/for for()} loops with
* {@see get_item()}
*
* @param int $max Maximum value to return. 0 for no limit
* @return int Number of items in the feed
*/
public function get_item_quantity(int $max = 0)
{
$qty = count($this->get_items());
if ($max === 0) {
return $qty;
}
return min($qty, $max);
}
/**
* Get a single item from the feed
*
* This is better suited for {@link http://php.net/for for()} loops, whereas
* {@see get_items()} is better suited for
* {@link http://php.net/foreach foreach()} loops.
*
* @see get_item_quantity()
* @since Beta 2
* @param int $key The item that you want to return. Remember that arrays begin with 0, not 1
* @return Item|null
*/
public function get_item(int $key = 0)
{
$items = $this->get_items();
if (isset($items[$key])) {
return $items[$key];
}
return null;
}
/**
* Get all items from the feed
*
* This is better suited for {@link http://php.net/for for()} loops, whereas
* {@see get_items()} is better suited for
* {@link http://php.net/foreach foreach()} loops.
*
* @see get_item_quantity
* @since Beta 2
* @param int $start Index to start at
* @param int $end Number of items to return. 0 for all items after `$start`
* @return Item[] List of {@see Item} objects
*/
public function get_items(int $start = 0, int $end = 0)
{
if (!isset($this->data['items'])) {
if (!empty($this->multifeed_objects)) {
$this->data['items'] = SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);
if (empty($this->data['items'])) {
return [];
}
return $this->data['items'];
}
$this->data['items'] = [];
if ($items = $this->get_feed_tags(self::NAMESPACE_ATOM_10, 'entry')) {
$keys = array_keys($items);
foreach ($keys as $key) {
$this->data['items'][] = $this->make_item($items[$key]);
}
}
if ($items = $this->get_feed_tags(self::NAMESPACE_ATOM_03, 'entry')) {
$keys = array_keys($items);
foreach ($keys as $key) {
$this->data['items'][] = $this->make_item($items[$key]);
}
}
if ($items = $this->get_feed_tags(self::NAMESPACE_RSS_10, 'item')) {
$keys = array_keys($items);
foreach ($keys as $key) {
$this->data['items'][] = $this->make_item($items[$key]);
}
}
if ($items = $this->get_feed_tags(self::NAMESPACE_RSS_090, 'item')) {
$keys = array_keys($items);
foreach ($keys as $key) {
$this->data['items'][] = $this->make_item($items[$key]);
}
}
if ($items = $this->get_channel_tags(self::NAMESPACE_RSS_20, 'item')) {
$keys = array_keys($items);
foreach ($keys as $key) {
$this->data['items'][] = $this->make_item($items[$key]);
}
}
}
if (empty($this->data['items'])) {
return [];
}
if ($this->order_by_date) {
if (!isset($this->data['ordered_items'])) {
$this->data['ordered_items'] = $this->data['items'];
usort($this->data['ordered_items'], [get_class($this), 'sort_items']);
}
$items = $this->data['ordered_items'];
} else {
$items = $this->data['items'];
}
// Slice the data as desired
if ($end === 0) {
return array_slice($items, $start);
}
return array_slice($items, $start, $end);
}
/**
* Set the favicon handler
*
* @deprecated Use your own favicon handling instead
* @param string|false $page
* @return bool
*/
public function set_favicon_handler($page = false, string $qs = 'i')
{
trigger_error('Favicon handling has been removed since SimplePie 1.3, please use your own handling', \E_USER_DEPRECATED);
return false;
}
/**
* Get the favicon for the current feed
*
* @deprecated Use your own favicon handling instead
* @return string|bool
*/
public function get_favicon()
{
trigger_error('Favicon handling has been removed since SimplePie 1.3, please use your own handling', \E_USER_DEPRECATED);
if (($url = $this->get_link()) !== null) {
return 'https://www.google.com/s2/favicons?domain=' . urlencode($url);
}
return false;
}
/**
* Magic method handler
*
* @param string $method Method name
* @param array $args Arguments to the method
* @return mixed
*/
public function __call(string $method, array $args)
{
if (strpos($method, 'subscribe_') === 0) {
trigger_error('subscribe_*() has been deprecated since SimplePie 1.3, implement the callback yourself', \E_USER_DEPRECATED);
return '';
}
if ($method === 'enable_xml_dump') {
trigger_error('enable_xml_dump() has been deprecated since SimplePie 1.3, use get_raw_data() instead', \E_USER_DEPRECATED);
return false;
}
$class = get_class($this);
$trace = debug_backtrace(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
$file = $trace[0]['file'] ?? '';
$line = $trace[0]['line'] ?? '';
throw new SimplePieException("Call to undefined method $class::$method() in $file on line $line");
}
/**
* Item factory
*
* @param array $data
*/
private function make_item(array $data): Item
{
$item = $this->registry->create(Item::class, [$this, $data]);
$item->set_sanitize($this->sanitize);
return $item;
}
/**
* Sorting callback for items
*
* @access private
* @param Item $a
* @param Item $b
* @return -1|0|1
*/
public static function sort_items(Item $a, Item $b)
{
$a_date = $a->get_date('U');
$b_date = $b->get_date('U');
if ($a_date && $b_date) {
return $a_date > $b_date ? -1 : 1;
}
// Sort items without dates to the top.
if ($a_date) {
return 1;
}
if ($b_date) {
return -1;
}
return 0;
}
/**
* Merge items from several feeds into one
*
* If you're merging multiple feeds together, they need to all have dates
* for the items or else SimplePie will refuse to sort them.
*
* @link http://simplepie.org/wiki/tutorial/sort_multiple_feeds_by_time_and_date#if_feeds_require_separate_per-feed_settings
* @param array $urls List of SimplePie feed objects to merge
* @param int $start Starting item
* @param int $end Number of items to return
* @param int $limit Maximum number of items per feed
* @return array
*/
public static function merge_items(array $urls, int $start = 0, int $end = 0, int $limit = 0)
{
if (count($urls) > 0) {
$items = [];
foreach ($urls as $arg) {
if ($arg instanceof SimplePie) {
$items = array_merge($items, $arg->get_items(0, $limit));
// @phpstan-ignore-next-line Enforce PHPDoc type.
} else {
trigger_error('Arguments must be SimplePie objects', E_USER_WARNING);
}
}
usort($items, [get_class($urls[0]), 'sort_items']);
if ($end === 0) {
return array_slice($items, $start);
}
return array_slice($items, $start, $end);
}
trigger_error('Cannot merge zero SimplePie objects', E_USER_WARNING);
return [];
}
/**
* Store PubSubHubbub links as headers
*
* There is no way to find PuSH links in the body of a microformats feed,
* so they are added to the headers when found, to be used later by get_links.
*/
private function store_links(Response $file, ?string $hub, ?string $self): Response
{
$linkHeaderLine = $file->get_header_line('link');
$linkHeader = $file->get_header('link');
if ($hub && !preg_match('/rel=hub/', $linkHeaderLine)) {
$linkHeader[] = '<'.$hub.'>; rel=hub';
}
if ($self && !preg_match('/rel=self/', $linkHeaderLine)) {
$linkHeader[] = '<'.$self.'>; rel=self';
}
if (count($linkHeader) > 0) {
$file = $file->with_header('link', $linkHeader);
}
return $file;
}
/**
* Get a DataCache
*
* @param string $feed_url Only needed for BC, can be removed in SimplePie 2.0.0
*
* @return DataCache
*/
private function get_cache(string $feed_url = ''): DataCache
{
if ($this->cache === null) {
// @trigger_error(sprintf('Not providing as PSR-16 cache implementation is deprecated since SimplePie 1.8.0, please use "SimplePie\SimplePie::set_cache()".'), \E_USER_DEPRECATED);
$cache = $this->registry->call(Cache::class, 'get_handler', [
$this->cache_location,
$this->get_cache_filename($feed_url),
Base::TYPE_FEED
]);
return new BaseDataCache($cache);
}
return $this->cache;
}
/**
* Get a HTTP client
*/
private function get_http_client(): Client
{
if ($this->http_client === null) {
$this->http_client = new FileClient(
$this->get_registry(),
[
'timeout' => $this->timeout,
'redirects' => 5,
'useragent' => $this->useragent,
'force_fsockopen' => $this->force_fsockopen,
'curl_options' => $this->curl_options,
]
);
$this->http_client_injected = true;
}
return $this->http_client;
}
}
class_alias('SimplePie\SimplePie', 'SimplePie');
PK \QK K src/File.phpnu [ > Canonical representation of headers */
private $parsed_headers = [];
/** @var array Last known value of $headers property (used to detect external modification) */
private $last_headers = [];
/**
* @var array Headers as string for BC
* @deprecated Use `get_headers()` method.
*/
public $headers = [];
/**
* @var ?string Body of the HTTP response
* @deprecated Use `get_body_content()` method.
*/
public $body;
/**
* @var int Status code of the HTTP response
* @deprecated Use `get_status_code()` method.
*/
public $status_code = 0;
/** @var non-negative-int Number of redirect that were already performed during this request sequence. */
public $redirects = 0;
/** @var ?string */
public $error;
/**
* @var int-mask-of Bit mask representing the method used to fetch the file and whether it is a local file or remote file obtained over HTTP.
* @deprecated Backend is implementation detail which you should not care about; to see if the file was retrieved over HTTP, check if `get_final_requested_uri()` with `Misc::is_remote_uri()`.
*/
public $method = \SimplePie\SimplePie::FILE_SOURCE_NONE;
/**
* @var string The permanent URL or the resource (first URL after the prefix of (only) permanent redirects)
* @deprecated Use `get_permanent_uri()` method.
*/
public $permanent_url;
/** @var bool Whether the permanent URL is still writeable (prefix of permanent redirects has not ended) */
private $permanentUrlMutable = true;
/**
* @param string $url
* @param int $timeout
* @param int $redirects
* @param ?array $headers
* @param ?string $useragent
* @param bool $force_fsockopen
* @param array $curl_options
*/
public function __construct(string $url, int $timeout = 10, int $redirects = 5, ?array $headers = null, ?string $useragent = null, bool $force_fsockopen = false, array $curl_options = [])
{
if (function_exists('idn_to_ascii')) {
$parsed = \SimplePie\Misc::parse_url($url);
if ($parsed['authority'] !== '' && !ctype_print($parsed['authority'])) {
$authority = (string) \idn_to_ascii($parsed['authority'], \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46);
$url = \SimplePie\Misc::compress_parse_url($parsed['scheme'], $authority, $parsed['path'], $parsed['query'], null);
}
}
$this->url = $url;
if ($this->permanentUrlMutable) {
$this->permanent_url = $url;
}
$this->useragent = $useragent;
if (preg_match('/^http(s)?:\/\//i', $url)) {
if ($useragent === null) {
$useragent = (string) ini_get('user_agent');
$this->useragent = $useragent;
}
if (!is_array($headers)) {
$headers = [];
}
if (!$force_fsockopen && function_exists('curl_exec')) {
$this->method = \SimplePie\SimplePie::FILE_SOURCE_REMOTE | \SimplePie\SimplePie::FILE_SOURCE_CURL;
$fp = curl_init();
$headers2 = [];
foreach ($headers as $key => $value) {
$headers2[] = "$key: $value";
}
if (isset($curl_options[CURLOPT_HTTPHEADER])) {
if (is_array($curl_options[CURLOPT_HTTPHEADER])) {
$headers2 = array_merge($headers2, $curl_options[CURLOPT_HTTPHEADER]);
}
unset($curl_options[CURLOPT_HTTPHEADER]);
}
if (version_compare(\SimplePie\Misc::get_curl_version(), '7.10.5', '>=')) {
curl_setopt($fp, CURLOPT_ENCODING, '');
}
curl_setopt($fp, CURLOPT_URL, $url);
curl_setopt($fp, CURLOPT_HEADER, 1);
curl_setopt($fp, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($fp, CURLOPT_FAILONERROR, 1);
curl_setopt($fp, CURLOPT_TIMEOUT, $timeout);
curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($fp, CURLOPT_REFERER, \SimplePie\Misc::url_remove_credentials($url));
curl_setopt($fp, CURLOPT_USERAGENT, $useragent);
curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2);
foreach ($curl_options as $curl_param => $curl_value) {
curl_setopt($fp, $curl_param, $curl_value);
}
$responseHeaders = curl_exec($fp);
if (curl_errno($fp) === CURLE_WRITE_ERROR || curl_errno($fp) === CURLE_BAD_CONTENT_ENCODING) {
curl_setopt($fp, CURLOPT_ENCODING, 'none');
$responseHeaders = curl_exec($fp);
}
$this->status_code = curl_getinfo($fp, CURLINFO_HTTP_CODE);
if (curl_errno($fp)) {
$this->error = 'cURL error ' . curl_errno($fp) . ': ' . curl_error($fp);
$this->success = false;
} else {
// Use the updated url provided by curl_getinfo after any redirects.
if ($info = curl_getinfo($fp)) {
$this->url = $info['url'];
}
// For PHPStan: We already checked that error did not occur.
assert(is_array($info) && $info['redirect_count'] >= 0);
if (\PHP_VERSION_ID < 80000) {
curl_close($fp);
}
$responseHeaders = \SimplePie\HTTP\Parser::prepareHeaders((string) $responseHeaders, $info['redirect_count'] + 1);
$parser = new \SimplePie\HTTP\Parser($responseHeaders, true);
if ($parser->parse()) {
$this->set_headers($parser->headers);
$this->body = $parser->body;
$this->status_code = $parser->status_code;
if ((in_array($this->status_code, [300, 301, 302, 303, 307]) || $this->status_code > 307 && $this->status_code < 400) && ($locationHeader = $this->get_header_line('location')) !== '' && $this->redirects < $redirects) {
$this->redirects++;
$location = \SimplePie\Misc::absolutize_url($locationHeader, $url);
if ($location === false) {
$this->error = "Invalid redirect location, trying to base “{$locationHeader}” onto “{$url}”";
$this->success = false;
return;
}
$this->permanentUrlMutable = $this->permanentUrlMutable && ($this->status_code == 301 || $this->status_code == 308);
$this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen, $curl_options);
return;
}
}
}
} else {
$this->method = \SimplePie\SimplePie::FILE_SOURCE_REMOTE | \SimplePie\SimplePie::FILE_SOURCE_FSOCKOPEN;
if (($url_parts = parse_url($url)) === false) {
throw new \InvalidArgumentException('Malformed URL: ' . $url);
}
if (!isset($url_parts['host'])) {
throw new \InvalidArgumentException('Missing hostname: ' . $url);
}
$socket_host = $url_parts['host'];
if (isset($url_parts['scheme']) && strtolower($url_parts['scheme']) === 'https') {
$socket_host = 'ssl://' . $socket_host;
$url_parts['port'] = 443;
}
if (!isset($url_parts['port'])) {
$url_parts['port'] = 80;
}
$fp = @fsockopen($socket_host, $url_parts['port'], $errno, $errstr, $timeout);
if (!$fp) {
$this->error = 'fsockopen error: ' . $errstr;
$this->success = false;
} else {
stream_set_timeout($fp, $timeout);
if (isset($url_parts['path'])) {
if (isset($url_parts['query'])) {
$get = "$url_parts[path]?$url_parts[query]";
} else {
$get = $url_parts['path'];
}
} else {
$get = '/';
}
$out = "GET $get HTTP/1.1\r\n";
$out .= "Host: $url_parts[host]\r\n";
$out .= "User-Agent: $useragent\r\n";
if (extension_loaded('zlib')) {
$out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n";
}
if (isset($url_parts['user']) && isset($url_parts['pass'])) {
$out .= "Authorization: Basic " . base64_encode("$url_parts[user]:$url_parts[pass]") . "\r\n";
}
foreach ($headers as $key => $value) {
$out .= "$key: $value\r\n";
}
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
$info = stream_get_meta_data($fp);
$responseHeaders = '';
while (!$info['eof'] && !$info['timed_out']) {
$responseHeaders .= fread($fp, 1160);
$info = stream_get_meta_data($fp);
}
if (!$info['timed_out']) {
$parser = new \SimplePie\HTTP\Parser($responseHeaders, true);
if ($parser->parse()) {
$this->set_headers($parser->headers);
$this->body = $parser->body;
$this->status_code = $parser->status_code;
if ((in_array($this->status_code, [300, 301, 302, 303, 307]) || $this->status_code > 307 && $this->status_code < 400) && ($locationHeader = $this->get_header_line('location')) !== '' && $this->redirects < $redirects) {
$this->redirects++;
$location = \SimplePie\Misc::absolutize_url($locationHeader, $url);
$this->permanentUrlMutable = $this->permanentUrlMutable && ($this->status_code == 301 || $this->status_code == 308);
if ($location === false) {
$this->error = "Invalid redirect location, trying to base “{$locationHeader}” onto “{$url}”";
$this->success = false;
return;
}
$this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen, $curl_options);
return;
}
if (($contentEncodingHeader = $this->get_header_line('content-encoding')) !== '') {
// Hey, we act dumb elsewhere, so let's do that here too
switch (strtolower(trim($contentEncodingHeader, "\x09\x0A\x0D\x20"))) {
case 'gzip':
case 'x-gzip':
if (($decompressed = gzdecode($this->body)) === false) {
$this->error = 'Unable to decode HTTP "gzip" stream';
$this->success = false;
} else {
$this->body = $decompressed;
}
break;
case 'deflate':
if (($decompressed = gzinflate($this->body)) !== false) {
$this->body = $decompressed;
} elseif (($decompressed = gzuncompress($this->body)) !== false) {
$this->body = $decompressed;
} elseif (($decompressed = gzdecode($this->body)) !== false) {
$this->body = $decompressed;
} else {
$this->error = 'Unable to decode HTTP "deflate" stream';
$this->success = false;
}
break;
default:
$this->error = 'Unknown content coding';
$this->success = false;
}
}
}
} else {
$this->error = 'fsocket timed out';
$this->success = false;
}
fclose($fp);
}
}
} else {
$this->method = \SimplePie\SimplePie::FILE_SOURCE_LOCAL | \SimplePie\SimplePie::FILE_SOURCE_FILE_GET_CONTENTS;
if (empty($url) || !is_readable($url) || false === $filebody = file_get_contents($url)) {
$this->body = '';
$this->error = sprintf('file "%s" is not readable', $url);
$this->success = false;
} else {
$this->body = $filebody;
$this->status_code = 200;
}
}
if ($this->success) {
assert($this->body !== null); // For PHPStan
// Leading whitespace may cause XML parsing errors (XML declaration cannot be preceded by anything other than BOM) so we trim it.
// Note that unlike built-in `trim` function’s default settings, we do not trim `\x00` to avoid breaking characters in UTF-16 or UTF-32 encoded strings.
// We also only do that when the whitespace is followed by `<`, so that we do not break e.g. UTF-16LE encoded whitespace like `\n\x00` in half.
$this->body = preg_replace('/^[ \n\r\t\v]+', '<', $this->body);
}
}
public function get_permanent_uri(): string
{
return (string) $this->permanent_url;
}
public function get_final_requested_uri(): string
{
return (string) $this->url;
}
public function get_status_code(): int
{
return (int) $this->status_code;
}
public function get_headers(): array
{
$this->maybe_update_headers();
return $this->parsed_headers;
}
public function has_header(string $name): bool
{
$this->maybe_update_headers();
return $this->get_header($name) !== [];
}
public function get_header(string $name): array
{
$this->maybe_update_headers();
return $this->parsed_headers[strtolower($name)] ?? [];
}
public function with_header(string $name, $value)
{
$this->maybe_update_headers();
$new = clone $this;
$newHeader = [
strtolower($name) => (array) $value,
];
$new->set_headers($newHeader + $this->get_headers());
return $new;
}
public function get_header_line(string $name): string
{
$this->maybe_update_headers();
return implode(', ', $this->get_header($name));
}
public function get_body_content(): string
{
return (string) $this->body;
}
/**
* Check if the $headers property was changed and update the internal state accordingly.
*/
private function maybe_update_headers(): void
{
if ($this->headers !== $this->last_headers) {
$this->parsed_headers = array_map(
function (string $header_line): array {
if (strpos($header_line, ',') === false) {
return [$header_line];
} else {
return array_map('trim', explode(',', $header_line));
}
},
$this->headers
);
}
$this->last_headers = $this->headers;
}
/**
* Sets headers internally.
*
* @param array> $headers
*/
private function set_headers(array $headers): void
{
$this->parsed_headers = $headers;
$this->headers = self::flatten_headers($headers);
$this->last_headers = $this->headers;
}
/**
* Converts PSR-7 compatible headers into a legacy format.
*
* @param array> $headers
*
* @return array
*/
private function flatten_headers(array $headers): array
{
return array_map(function (array $values): string {
return implode(',', $values);
}, $headers);
}
/**
* Create a File instance from another Response
*
* For BC reasons in some places there MUST be a `File` instance
* instead of a `Response` implementation
*
* @see Locator::__construct()
* @internal
*/
final public static function fromResponse(Response $response): self
{
$headers = [];
foreach ($response->get_headers() as $name => $header) {
$headers[$name] = implode(', ', $header);
}
/** @var File */
$file = (new \ReflectionClass(File::class))->newInstanceWithoutConstructor();
$file->url = $response->get_final_requested_uri();
$file->useragent = null;
$file->headers = $headers;
$file->body = $response->get_body_content();
$file->status_code = $response->get_status_code();
$file->permanent_url = $response->get_permanent_uri();
return $file;
}
}
class_alias('SimplePie\File', 'SimplePie_File');
PK \>Kl} } src/Enclosure.phpnu [ bitrate = $bitrate;
$this->captions = $captions;
$this->categories = $categories;
$this->channels = $channels;
$this->copyright = $copyright;
$this->credits = $credits;
$this->description = $description;
$this->duration = $duration;
$this->expression = $expression;
$this->framerate = $framerate;
$this->hashes = $hashes;
$this->height = $height;
$this->keywords = $keywords;
$this->lang = $lang;
$this->length = $length;
$this->link = $link;
$this->medium = $medium;
$this->player = $player;
$this->ratings = $ratings;
$this->restrictions = $restrictions;
$this->samplingrate = $samplingrate;
$this->thumbnails = $thumbnails;
$this->title = $title;
$this->type = $type;
$this->width = $width;
if (function_exists('idn_to_ascii')) {
$parsed = \SimplePie\Misc::parse_url($link ?? '');
if ($parsed['authority'] !== '' && !ctype_print($parsed['authority'])) {
$authority = (string) \idn_to_ascii($parsed['authority'], \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46);
$this->link = \SimplePie\Misc::compress_parse_url($parsed['scheme'], $authority, $parsed['path'], $parsed['query'], $parsed['fragment']);
}
}
$this->handler = $this->get_handler(); // Needs to load last
}
/**
* String-ified version
*
* @return string
*/
public function __toString()
{
// There is no $this->data here
return md5(serialize($this));
}
/**
* Get the bitrate
*
* @return string|null
*/
public function get_bitrate()
{
if ($this->bitrate !== null) {
return $this->bitrate;
}
return null;
}
/**
* Get a single caption
*
* @param int $key
* @return \SimplePie\Caption|null
*/
public function get_caption(int $key = 0)
{
$captions = $this->get_captions();
if (isset($captions[$key])) {
return $captions[$key];
}
return null;
}
/**
* Get all captions
*
* @return Caption[]|null
*/
public function get_captions()
{
if ($this->captions !== null) {
return $this->captions;
}
return null;
}
/**
* Get a single category
*
* @param int $key
* @return \SimplePie\Category|null
*/
public function get_category(int $key = 0)
{
$categories = $this->get_categories();
if (isset($categories[$key])) {
return $categories[$key];
}
return null;
}
/**
* Get all categories
*
* @return \SimplePie\Category[]|null
*/
public function get_categories()
{
if ($this->categories !== null) {
return $this->categories;
}
return null;
}
/**
* Get the number of audio channels
*
* @return int|null
*/
public function get_channels()
{
if ($this->channels !== null) {
return $this->channels;
}
return null;
}
/**
* Get the copyright information
*
* @return \SimplePie\Copyright|null
*/
public function get_copyright()
{
if ($this->copyright !== null) {
return $this->copyright;
}
return null;
}
/**
* Get a single credit
*
* @param int $key
* @return \SimplePie\Credit|null
*/
public function get_credit(int $key = 0)
{
$credits = $this->get_credits();
if (isset($credits[$key])) {
return $credits[$key];
}
return null;
}
/**
* Get all credits
*
* @return Credit[]|null
*/
public function get_credits()
{
if ($this->credits !== null) {
return $this->credits;
}
return null;
}
/**
* Get the description of the enclosure
*
* @return string|null
*/
public function get_description()
{
if ($this->description !== null) {
return $this->description;
}
return null;
}
/**
* Get the duration of the enclosure
*
* @param bool $convert Convert seconds into hh:mm:ss
* @return string|int|null 'hh:mm:ss' string if `$convert` was specified, otherwise integer (or null if none found)
*/
public function get_duration(bool $convert = false)
{
if ($this->duration !== null) {
if ($convert) {
$time = \SimplePie\Misc::time_hms($this->duration);
return $time;
}
return $this->duration;
}
return null;
}
/**
* Get the expression
*
* @return string Probably one of 'sample', 'full', 'nonstop', 'clip'. Defaults to 'full'
*/
public function get_expression()
{
if ($this->expression !== null) {
return $this->expression;
}
return 'full';
}
/**
* Get the file extension
*
* @return string|null
*/
public function get_extension()
{
if ($this->link !== null) {
$url = \SimplePie\Misc::parse_url($this->link);
if ($url['path'] !== '') {
return pathinfo($url['path'], PATHINFO_EXTENSION);
}
}
return null;
}
/**
* Get the framerate (in frames-per-second)
*
* @return string|null
*/
public function get_framerate()
{
if ($this->framerate !== null) {
return $this->framerate;
}
return null;
}
/**
* Get the preferred handler
*
* @return string|null One of 'flash', 'fmedia', 'quicktime', 'wmedia', 'mp3'
*/
public function get_handler()
{
return $this->get_real_type(true);
}
/**
* Get a single hash
*
* @link http://www.rssboard.org/media-rss#media-hash
* @param int $key
* @return string|null Hash as per `media:hash`, prefixed with "$algo:"
*/
public function get_hash(int $key = 0)
{
$hashes = $this->get_hashes();
if (isset($hashes[$key])) {
return $hashes[$key];
}
return null;
}
/**
* Get all credits
*
* @return string[]|null Array of strings, see {@see get_hash()}
*/
public function get_hashes()
{
if ($this->hashes !== null) {
return $this->hashes;
}
return null;
}
/**
* Get the height
*
* @return string|null
*/
public function get_height()
{
if ($this->height !== null) {
return $this->height;
}
return null;
}
/**
* Get the language
*
* @link http://tools.ietf.org/html/rfc3066
* @return string|null Language code as per RFC 3066
*/
public function get_language()
{
if ($this->lang !== null) {
return $this->lang;
}
return null;
}
/**
* Get a single keyword
*
* @param int $key
* @return string|null
*/
public function get_keyword(int $key = 0)
{
$keywords = $this->get_keywords();
if (isset($keywords[$key])) {
return $keywords[$key];
}
return null;
}
/**
* Get all keywords
*
* @return string[]|null
*/
public function get_keywords()
{
if ($this->keywords !== null) {
return $this->keywords;
}
return null;
}
/**
* Get length
*
* @return ?int Length in bytes
*/
public function get_length()
{
if ($this->length !== null) {
return $this->length;
}
return null;
}
/**
* Get the URL
*
* @return string|null
*/
public function get_link()
{
if ($this->link !== null) {
return $this->link;
}
return null;
}
/**
* Get the medium
*
* @link http://www.rssboard.org/media-rss#media-content
* @return string|null Should be one of 'image', 'audio', 'video', 'document', 'executable'
*/
public function get_medium()
{
if ($this->medium !== null) {
return $this->medium;
}
return null;
}
/**
* Get the player URL
*
* Typically the same as {@see get_permalink()}
* @return string|null Player URL
*/
public function get_player()
{
if ($this->player !== null) {
return $this->player;
}
return null;
}
/**
* Get a single rating
*
* @param int $key
* @return \SimplePie\Rating|null
*/
public function get_rating(int $key = 0)
{
$ratings = $this->get_ratings();
if (isset($ratings[$key])) {
return $ratings[$key];
}
return null;
}
/**
* Get all ratings
*
* @return Rating[]|null
*/
public function get_ratings()
{
if ($this->ratings !== null) {
return $this->ratings;
}
return null;
}
/**
* Get a single restriction
*
* @param int $key
* @return \SimplePie\Restriction|null
*/
public function get_restriction(int $key = 0)
{
$restrictions = $this->get_restrictions();
if (isset($restrictions[$key])) {
return $restrictions[$key];
}
return null;
}
/**
* Get all restrictions
*
* @return Restriction[]|null
*/
public function get_restrictions()
{
if ($this->restrictions !== null) {
return $this->restrictions;
}
return null;
}
/**
* Get the sampling rate (in kHz)
*
* @return string|null
*/
public function get_sampling_rate()
{
if ($this->samplingrate !== null) {
return $this->samplingrate;
}
return null;
}
/**
* Get the file size (in MiB)
*
* @return float|null File size in mebibytes (1048 bytes)
*/
public function get_size()
{
$length = $this->get_length();
if ($length !== null) {
return round($length / 1048576, 2);
}
return null;
}
/**
* Get a single thumbnail
*
* @param int $key
* @return string|null Thumbnail URL
*/
public function get_thumbnail(int $key = 0)
{
$thumbnails = $this->get_thumbnails();
if (isset($thumbnails[$key])) {
return $thumbnails[$key];
}
return null;
}
/**
* Get all thumbnails
*
* @return string[]|null Array of thumbnail URLs
*/
public function get_thumbnails()
{
if ($this->thumbnails !== null) {
return $this->thumbnails;
}
return null;
}
/**
* Get the title
*
* @return string|null
*/
public function get_title()
{
if ($this->title !== null) {
return $this->title;
}
return null;
}
/**
* Get mimetype of the enclosure
*
* @see get_real_type()
* @return string|null MIME type
*/
public function get_type()
{
if ($this->type !== null) {
return $this->type;
}
return null;
}
/**
* Get the width
*
* @return string|null
*/
public function get_width()
{
if ($this->width !== null) {
return $this->width;
}
return null;
}
/**
* Embed the enclosure using `