Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-inclu...
File: class-simplepie.php
// RFC 3023 (only applies to sniffed content)
[1500] Fix | Delete
if (isset($sniffed))
[1501] Fix | Delete
{
[1502] Fix | Delete
if (in_array($sniffed, $application_types) || substr($sniffed, 0, 12) === 'application/' && substr($sniffed, -4) === '+xml')
[1503] Fix | Delete
{
[1504] Fix | Delete
if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
[1505] Fix | Delete
{
[1506] Fix | Delete
$encodings[] = strtoupper($charset[1]);
[1507] Fix | Delete
}
[1508] Fix | Delete
$encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry)));
[1509] Fix | Delete
$encodings[] = 'UTF-8';
[1510] Fix | Delete
}
[1511] Fix | Delete
elseif (in_array($sniffed, $text_types) || substr($sniffed, 0, 5) === 'text/' && substr($sniffed, -4) === '+xml')
[1512] Fix | Delete
{
[1513] Fix | Delete
if (isset($headers['content-type']) && preg_match('/;\x20?charset=([^;]*)/i', $headers['content-type'], $charset))
[1514] Fix | Delete
{
[1515] Fix | Delete
$encodings[] = strtoupper($charset[1]);
[1516] Fix | Delete
}
[1517] Fix | Delete
$encodings[] = 'US-ASCII';
[1518] Fix | Delete
}
[1519] Fix | Delete
// Text MIME-type default
[1520] Fix | Delete
elseif (substr($sniffed, 0, 5) === 'text/')
[1521] Fix | Delete
{
[1522] Fix | Delete
$encodings[] = 'UTF-8';
[1523] Fix | Delete
}
[1524] Fix | Delete
}
[1525] Fix | Delete
[1526] Fix | Delete
// Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1
[1527] Fix | Delete
$encodings = array_merge($encodings, $this->registry->call('Misc', 'xml_encoding', array($this->raw_data, &$this->registry)));
[1528] Fix | Delete
$encodings[] = 'UTF-8';
[1529] Fix | Delete
$encodings[] = 'ISO-8859-1';
[1530] Fix | Delete
[1531] Fix | Delete
// There's no point in trying an encoding twice
[1532] Fix | Delete
$encodings = array_unique($encodings);
[1533] Fix | Delete
[1534] Fix | Delete
// Loop through each possible encoding, till we return something, or run out of possibilities
[1535] Fix | Delete
foreach ($encodings as $encoding)
[1536] Fix | Delete
{
[1537] Fix | Delete
// Change the encoding to UTF-8 (as we always use UTF-8 internally)
[1538] Fix | Delete
if ($utf8_data = $this->registry->call('Misc', 'change_encoding', array($this->raw_data, $encoding, 'UTF-8')))
[1539] Fix | Delete
{
[1540] Fix | Delete
// Create new parser
[1541] Fix | Delete
$parser = $this->registry->create('Parser');
[1542] Fix | Delete
[1543] Fix | Delete
// If it's parsed fine
[1544] Fix | Delete
if ($parser->parse($utf8_data, 'UTF-8', $this->permanent_url))
[1545] Fix | Delete
{
[1546] Fix | Delete
$this->data = $parser->get_data();
[1547] Fix | Delete
if (!($this->get_type() & ~SIMPLEPIE_TYPE_NONE))
[1548] Fix | Delete
{
[1549] Fix | Delete
$this->error = "A feed could not be found at `$this->feed_url`. This does not appear to be a valid RSS or Atom feed.";
[1550] Fix | Delete
$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
[1551] Fix | Delete
return false;
[1552] Fix | Delete
}
[1553] Fix | Delete
[1554] Fix | Delete
if (isset($headers))
[1555] Fix | Delete
{
[1556] Fix | Delete
$this->data['headers'] = $headers;
[1557] Fix | Delete
}
[1558] Fix | Delete
$this->data['build'] = SIMPLEPIE_BUILD;
[1559] Fix | Delete
[1560] Fix | Delete
// Cache the file if caching is enabled
[1561] Fix | Delete
if ($cache && !$cache->save($this))
[1562] Fix | Delete
{
[1563] Fix | Delete
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);
[1564] Fix | Delete
}
[1565] Fix | Delete
return true;
[1566] Fix | Delete
}
[1567] Fix | Delete
}
[1568] Fix | Delete
}
[1569] Fix | Delete
[1570] Fix | Delete
if (isset($parser))
[1571] Fix | Delete
{
[1572] Fix | Delete
// We have an error, just set SimplePie_Misc::error to it and quit
[1573] Fix | Delete
$this->error = $this->feed_url;
[1574] Fix | Delete
$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());
[1575] Fix | Delete
}
[1576] Fix | Delete
else
[1577] Fix | Delete
{
[1578] Fix | Delete
$this->error = 'The data could not be converted to UTF-8.';
[1579] Fix | Delete
if (!extension_loaded('mbstring') && !extension_loaded('iconv') && !class_exists('\UConverter')) {
[1580] Fix | Delete
$this->error .= ' You MUST have either the iconv, mbstring or intl (PHP 5.5+) extension installed and enabled.';
[1581] Fix | Delete
} else {
[1582] Fix | Delete
$missingExtensions = array();
[1583] Fix | Delete
if (!extension_loaded('iconv')) {
[1584] Fix | Delete
$missingExtensions[] = 'iconv';
[1585] Fix | Delete
}
[1586] Fix | Delete
if (!extension_loaded('mbstring')) {
[1587] Fix | Delete
$missingExtensions[] = 'mbstring';
[1588] Fix | Delete
}
[1589] Fix | Delete
if (!class_exists('\UConverter')) {
[1590] Fix | Delete
$missingExtensions[] = 'intl (PHP 5.5+)';
[1591] Fix | Delete
}
[1592] Fix | Delete
$this->error .= ' Try installing/enabling the ' . implode(' or ', $missingExtensions) . ' extension.';
[1593] Fix | Delete
}
[1594] Fix | Delete
}
[1595] Fix | Delete
[1596] Fix | Delete
$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
[1597] Fix | Delete
[1598] Fix | Delete
return false;
[1599] Fix | Delete
}
[1600] Fix | Delete
[1601] Fix | Delete
/**
[1602] Fix | Delete
* Fetch the data via SimplePie_File
[1603] Fix | Delete
*
[1604] Fix | Delete
* If the data is already cached, attempt to fetch it from there instead
[1605] Fix | Delete
* @param SimplePie_Cache_Base|false $cache Cache handler, or false to not load from the cache
[1606] Fix | Delete
* @return array|true Returns true if the data was loaded from the cache, or an array of HTTP headers and sniffed type
[1607] Fix | Delete
*/
[1608] Fix | Delete
protected function fetch_data(&$cache)
[1609] Fix | Delete
{
[1610] Fix | Delete
// If it's enabled, use the cache
[1611] Fix | Delete
if ($cache)
[1612] Fix | Delete
{
[1613] Fix | Delete
// Load the Cache
[1614] Fix | Delete
$this->data = $cache->load();
[1615] Fix | Delete
if (!empty($this->data))
[1616] Fix | Delete
{
[1617] Fix | Delete
// If the cache is for an outdated build of SimplePie
[1618] Fix | Delete
if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD)
[1619] Fix | Delete
{
[1620] Fix | Delete
$cache->unlink();
[1621] Fix | Delete
$this->data = array();
[1622] Fix | Delete
}
[1623] Fix | Delete
// If we've hit a collision just rerun it with caching disabled
[1624] Fix | Delete
elseif (isset($this->data['url']) && $this->data['url'] !== $this->feed_url)
[1625] Fix | Delete
{
[1626] Fix | Delete
$cache = false;
[1627] Fix | Delete
$this->data = array();
[1628] Fix | Delete
}
[1629] Fix | Delete
// If we've got a non feed_url stored (if the page isn't actually a feed, or is a redirect) use that URL.
[1630] Fix | Delete
elseif (isset($this->data['feed_url']))
[1631] Fix | Delete
{
[1632] Fix | Delete
// If the autodiscovery cache is still valid use it.
[1633] Fix | Delete
if ($cache->mtime() + $this->autodiscovery_cache_duration > time())
[1634] Fix | Delete
{
[1635] Fix | Delete
// Do not need to do feed autodiscovery yet.
[1636] Fix | Delete
if ($this->data['feed_url'] !== $this->data['url'])
[1637] Fix | Delete
{
[1638] Fix | Delete
$this->set_feed_url($this->data['feed_url']);
[1639] Fix | Delete
return $this->init();
[1640] Fix | Delete
}
[1641] Fix | Delete
[1642] Fix | Delete
$cache->unlink();
[1643] Fix | Delete
$this->data = array();
[1644] Fix | Delete
}
[1645] Fix | Delete
}
[1646] Fix | Delete
// Check if the cache has been updated
[1647] Fix | Delete
elseif ($cache->mtime() + $this->cache_duration < time())
[1648] Fix | Delete
{
[1649] Fix | Delete
// Want to know if we tried to send last-modified and/or etag headers
[1650] Fix | Delete
// when requesting this file. (Note that it's up to the file to
[1651] Fix | Delete
// support this, but we don't always send the headers either.)
[1652] Fix | Delete
$this->check_modified = true;
[1653] Fix | Delete
if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag']))
[1654] Fix | Delete
{
[1655] Fix | Delete
$headers = array(
[1656] Fix | Delete
'Accept' => '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',
[1657] Fix | Delete
);
[1658] Fix | Delete
if (isset($this->data['headers']['last-modified']))
[1659] Fix | Delete
{
[1660] Fix | Delete
$headers['if-modified-since'] = $this->data['headers']['last-modified'];
[1661] Fix | Delete
}
[1662] Fix | Delete
if (isset($this->data['headers']['etag']))
[1663] Fix | Delete
{
[1664] Fix | Delete
$headers['if-none-match'] = $this->data['headers']['etag'];
[1665] Fix | Delete
}
[1666] Fix | Delete
[1667] Fix | Delete
$file = $this->registry->create('File', array($this->feed_url, $this->timeout/10, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options));
[1668] Fix | Delete
$this->status_code = $file->status_code;
[1669] Fix | Delete
[1670] Fix | Delete
if ($file->success)
[1671] Fix | Delete
{
[1672] Fix | Delete
if ($file->status_code === 304)
[1673] Fix | Delete
{
[1674] Fix | Delete
// Set raw_data to false here too, to signify that the cache
[1675] Fix | Delete
// is still valid.
[1676] Fix | Delete
$this->raw_data = false;
[1677] Fix | Delete
$cache->touch();
[1678] Fix | Delete
return true;
[1679] Fix | Delete
}
[1680] Fix | Delete
}
[1681] Fix | Delete
else
[1682] Fix | Delete
{
[1683] Fix | Delete
$this->check_modified = false;
[1684] Fix | Delete
if($this->force_cache_fallback)
[1685] Fix | Delete
{
[1686] Fix | Delete
$cache->touch();
[1687] Fix | Delete
return true;
[1688] Fix | Delete
}
[1689] Fix | Delete
[1690] Fix | Delete
unset($file);
[1691] Fix | Delete
}
[1692] Fix | Delete
}
[1693] Fix | Delete
}
[1694] Fix | Delete
// If the cache is still valid, just return true
[1695] Fix | Delete
else
[1696] Fix | Delete
{
[1697] Fix | Delete
$this->raw_data = false;
[1698] Fix | Delete
return true;
[1699] Fix | Delete
}
[1700] Fix | Delete
}
[1701] Fix | Delete
// If the cache is empty, delete it
[1702] Fix | Delete
else
[1703] Fix | Delete
{
[1704] Fix | Delete
$cache->unlink();
[1705] Fix | Delete
$this->data = array();
[1706] Fix | Delete
}
[1707] Fix | Delete
}
[1708] Fix | Delete
// 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.
[1709] Fix | Delete
if (!isset($file))
[1710] Fix | Delete
{
[1711] Fix | Delete
if ($this->file instanceof SimplePie_File && $this->file->url === $this->feed_url)
[1712] Fix | Delete
{
[1713] Fix | Delete
$file =& $this->file;
[1714] Fix | Delete
}
[1715] Fix | Delete
else
[1716] Fix | Delete
{
[1717] Fix | Delete
$headers = array(
[1718] Fix | Delete
'Accept' => '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',
[1719] Fix | Delete
);
[1720] Fix | Delete
$file = $this->registry->create('File', array($this->feed_url, $this->timeout, 5, $headers, $this->useragent, $this->force_fsockopen, $this->curl_options));
[1721] Fix | Delete
}
[1722] Fix | Delete
}
[1723] Fix | Delete
$this->status_code = $file->status_code;
[1724] Fix | Delete
[1725] Fix | Delete
// If the file connection has an error, set SimplePie::error to that and quit
[1726] Fix | Delete
if (!$file->success && !($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE === 0 || ($file->status_code === 200 || $file->status_code > 206 && $file->status_code < 300)))
[1727] Fix | Delete
{
[1728] Fix | Delete
$this->error = $file->error;
[1729] Fix | Delete
return !empty($this->data);
[1730] Fix | Delete
}
[1731] Fix | Delete
[1732] Fix | Delete
if (!$this->force_feed)
[1733] Fix | Delete
{
[1734] Fix | Delete
// Check if the supplied URL is a feed, if it isn't, look for it.
[1735] Fix | Delete
$locate = $this->registry->create('Locator', array(&$file, $this->timeout, $this->useragent, $this->max_checked_feeds, $this->force_fsockopen, $this->curl_options));
[1736] Fix | Delete
[1737] Fix | Delete
if (!$locate->is_feed($file))
[1738] Fix | Delete
{
[1739] Fix | Delete
$copyStatusCode = $file->status_code;
[1740] Fix | Delete
$copyContentType = $file->headers['content-type'];
[1741] Fix | Delete
try
[1742] Fix | Delete
{
[1743] Fix | Delete
$microformats = false;
[1744] Fix | Delete
if (class_exists('DOMXpath') && function_exists('Mf2\parse')) {
[1745] Fix | Delete
$doc = new DOMDocument();
[1746] Fix | Delete
@$doc->loadHTML($file->body);
[1747] Fix | Delete
$xpath = new DOMXpath($doc);
[1748] Fix | Delete
// Check for both h-feed and h-entry, as both a feed with no entries
[1749] Fix | Delete
// and a list of entries without an h-feed wrapper are both valid.
[1750] Fix | Delete
$query = '//*[contains(concat(" ", @class, " "), " h-feed ") or '.
[1751] Fix | Delete
'contains(concat(" ", @class, " "), " h-entry ")]';
[1752] Fix | Delete
$result = $xpath->query($query);
[1753] Fix | Delete
$microformats = $result->length !== 0;
[1754] Fix | Delete
}
[1755] Fix | Delete
// Now also do feed discovery, but if microformats were found don't
[1756] Fix | Delete
// overwrite the current value of file.
[1757] Fix | Delete
$discovered = $locate->find($this->autodiscovery,
[1758] Fix | Delete
$this->all_discovered_feeds);
[1759] Fix | Delete
if ($microformats)
[1760] Fix | Delete
{
[1761] Fix | Delete
if ($hub = $locate->get_rel_link('hub'))
[1762] Fix | Delete
{
[1763] Fix | Delete
$self = $locate->get_rel_link('self');
[1764] Fix | Delete
$this->store_links($file, $hub, $self);
[1765] Fix | Delete
}
[1766] Fix | Delete
// Push the current file onto all_discovered feeds so the user can
[1767] Fix | Delete
// be shown this as one of the options.
[1768] Fix | Delete
if (isset($this->all_discovered_feeds)) {
[1769] Fix | Delete
$this->all_discovered_feeds[] = $file;
[1770] Fix | Delete
}
[1771] Fix | Delete
}
[1772] Fix | Delete
else
[1773] Fix | Delete
{
[1774] Fix | Delete
if ($discovered)
[1775] Fix | Delete
{
[1776] Fix | Delete
$file = $discovered;
[1777] Fix | Delete
}
[1778] Fix | Delete
else
[1779] Fix | Delete
{
[1780] Fix | Delete
// We need to unset this so that if SimplePie::set_file() has
[1781] Fix | Delete
// been called that object is untouched
[1782] Fix | Delete
unset($file);
[1783] Fix | Delete
$this->error = "A feed could not be found at `$this->feed_url`; the status code is `$copyStatusCode` and content-type is `$copyContentType`";
[1784] Fix | Delete
$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, __FILE__, __LINE__));
[1785] Fix | Delete
return false;
[1786] Fix | Delete
}
[1787] Fix | Delete
}
[1788] Fix | Delete
}
[1789] Fix | Delete
catch (SimplePie_Exception $e)
[1790] Fix | Delete
{
[1791] Fix | Delete
// We need to unset this so that if SimplePie::set_file() has been called that object is untouched
[1792] Fix | Delete
unset($file);
[1793] Fix | Delete
// This is usually because DOMDocument doesn't exist
[1794] Fix | Delete
$this->error = $e->getMessage();
[1795] Fix | Delete
$this->registry->call('Misc', 'error', array($this->error, E_USER_NOTICE, $e->getFile(), $e->getLine()));
[1796] Fix | Delete
return false;
[1797] Fix | Delete
}
[1798] Fix | Delete
if ($cache)
[1799] Fix | Delete
{
[1800] Fix | Delete
$this->data = array('url' => $this->feed_url, 'feed_url' => $file->url, 'build' => SIMPLEPIE_BUILD);
[1801] Fix | Delete
if (!$cache->save($this))
[1802] Fix | Delete
{
[1803] Fix | Delete
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);
[1804] Fix | Delete
}
[1805] Fix | Delete
$cache = $this->registry->call('Cache', 'get_handler', array($this->cache_location, call_user_func($this->cache_name_function, $file->url), 'spc'));
[1806] Fix | Delete
}
[1807] Fix | Delete
}
[1808] Fix | Delete
$this->feed_url = $file->url;
[1809] Fix | Delete
$locate = null;
[1810] Fix | Delete
}
[1811] Fix | Delete
[1812] Fix | Delete
$this->raw_data = $file->body;
[1813] Fix | Delete
$this->permanent_url = $file->permanent_url;
[1814] Fix | Delete
$headers = $file->headers;
[1815] Fix | Delete
$sniffer = $this->registry->create('Content_Type_Sniffer', array(&$file));
[1816] Fix | Delete
$sniffed = $sniffer->get_type();
[1817] Fix | Delete
[1818] Fix | Delete
return array($headers, $sniffed);
[1819] Fix | Delete
}
[1820] Fix | Delete
[1821] Fix | Delete
/**
[1822] Fix | Delete
* Get the error message for the occurred error
[1823] Fix | Delete
*
[1824] Fix | Delete
* @return string|array Error message, or array of messages for multifeeds
[1825] Fix | Delete
*/
[1826] Fix | Delete
public function error()
[1827] Fix | Delete
{
[1828] Fix | Delete
return $this->error;
[1829] Fix | Delete
}
[1830] Fix | Delete
[1831] Fix | Delete
/**
[1832] Fix | Delete
* Get the last HTTP status code
[1833] Fix | Delete
*
[1834] Fix | Delete
* @return int Status code
[1835] Fix | Delete
*/
[1836] Fix | Delete
public function status_code()
[1837] Fix | Delete
{
[1838] Fix | Delete
return $this->status_code;
[1839] Fix | Delete
}
[1840] Fix | Delete
[1841] Fix | Delete
/**
[1842] Fix | Delete
* Get the raw XML
[1843] Fix | Delete
*
[1844] Fix | Delete
* This is the same as the old `$feed->enable_xml_dump(true)`, but returns
[1845] Fix | Delete
* the data instead of printing it.
[1846] Fix | Delete
*
[1847] Fix | Delete
* @return string|boolean Raw XML data, false if the cache is used
[1848] Fix | Delete
*/
[1849] Fix | Delete
public function get_raw_data()
[1850] Fix | Delete
{
[1851] Fix | Delete
return $this->raw_data;
[1852] Fix | Delete
}
[1853] Fix | Delete
[1854] Fix | Delete
/**
[1855] Fix | Delete
* Get the character encoding used for output
[1856] Fix | Delete
*
[1857] Fix | Delete
* @since Preview Release
[1858] Fix | Delete
* @return string
[1859] Fix | Delete
*/
[1860] Fix | Delete
public function get_encoding()
[1861] Fix | Delete
{
[1862] Fix | Delete
return $this->sanitize->output_encoding;
[1863] Fix | Delete
}
[1864] Fix | Delete
[1865] Fix | Delete
/**
[1866] Fix | Delete
* Send the Content-Type header with correct encoding
[1867] Fix | Delete
*
[1868] Fix | Delete
* This method ensures that the SimplePie-enabled page is being served with
[1869] Fix | Delete
* the correct {@link http://www.iana.org/assignments/media-types/ mime-type}
[1870] Fix | Delete
* and character encoding HTTP headers (character encoding determined by the
[1871] Fix | Delete
* {@see set_output_encoding} config option).
[1872] Fix | Delete
*
[1873] Fix | Delete
* This won't work properly if any content or whitespace has already been
[1874] Fix | Delete
* sent to the browser, because it relies on PHP's
[1875] Fix | Delete
* {@link http://php.net/header header()} function, and these are the
[1876] Fix | Delete
* circumstances under which the function works.
[1877] Fix | Delete
*
[1878] Fix | Delete
* Because it's setting these settings for the entire page (as is the nature
[1879] Fix | Delete
* of HTTP headers), this should only be used once per page (again, at the
[1880] Fix | Delete
* top).
[1881] Fix | Delete
*
[1882] Fix | Delete
* @param string $mime MIME type to serve the page as
[1883] Fix | Delete
*/
[1884] Fix | Delete
public function handle_content_type($mime = 'text/html')
[1885] Fix | Delete
{
[1886] Fix | Delete
if (!headers_sent())
[1887] Fix | Delete
{
[1888] Fix | Delete
$header = "Content-Type: $mime;";
[1889] Fix | Delete
if ($this->get_encoding())
[1890] Fix | Delete
{
[1891] Fix | Delete
$header .= ' charset=' . $this->get_encoding();
[1892] Fix | Delete
}
[1893] Fix | Delete
else
[1894] Fix | Delete
{
[1895] Fix | Delete
$header .= ' charset=UTF-8';
[1896] Fix | Delete
}
[1897] Fix | Delete
header($header);
[1898] Fix | Delete
}
[1899] Fix | Delete
}
[1900] Fix | Delete
[1901] Fix | Delete
/**
[1902] Fix | Delete
* Get the type of the feed
[1903] Fix | Delete
*
[1904] Fix | Delete
* This returns a SIMPLEPIE_TYPE_* constant, which can be tested against
[1905] Fix | Delete
* using {@link http://php.net/language.operators.bitwise bitwise operators}
[1906] Fix | Delete
*
[1907] Fix | Delete
* @since 0.8 (usage changed to using constants in 1.0)
[1908] Fix | Delete
* @see SIMPLEPIE_TYPE_NONE Unknown.
[1909] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_090 RSS 0.90.
[1910] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_091_NETSCAPE RSS 0.91 (Netscape).
[1911] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_091_USERLAND RSS 0.91 (Userland).
[1912] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_091 RSS 0.91.
[1913] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_092 RSS 0.92.
[1914] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_093 RSS 0.93.
[1915] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_094 RSS 0.94.
[1916] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_10 RSS 1.0.
[1917] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_20 RSS 2.0.x.
[1918] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_RDF RDF-based RSS.
[1919] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_SYNDICATION Non-RDF-based RSS (truly intended as syndication format).
[1920] Fix | Delete
* @see SIMPLEPIE_TYPE_RSS_ALL Any version of RSS.
[1921] Fix | Delete
* @see SIMPLEPIE_TYPE_ATOM_03 Atom 0.3.
[1922] Fix | Delete
* @see SIMPLEPIE_TYPE_ATOM_10 Atom 1.0.
[1923] Fix | Delete
* @see SIMPLEPIE_TYPE_ATOM_ALL Any version of Atom.
[1924] Fix | Delete
* @see SIMPLEPIE_TYPE_ALL Any known/supported feed type.
[1925] Fix | Delete
* @return int SIMPLEPIE_TYPE_* constant
[1926] Fix | Delete
*/
[1927] Fix | Delete
public function get_type()
[1928] Fix | Delete
{
[1929] Fix | Delete
if (!isset($this->data['type']))
[1930] Fix | Delete
{
[1931] Fix | Delete
$this->data['type'] = SIMPLEPIE_TYPE_ALL;
[1932] Fix | Delete
if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['feed']))
[1933] Fix | Delete
{
[1934] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_ATOM_10;
[1935] Fix | Delete
}
[1936] Fix | Delete
elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['feed']))
[1937] Fix | Delete
{
[1938] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_ATOM_03;
[1939] Fix | Delete
}
[1940] Fix | Delete
elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF']))
[1941] Fix | Delete
{
[1942] Fix | Delete
if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['channel'])
[1943] Fix | Delete
|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['image'])
[1944] Fix | Delete
|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['item'])
[1945] Fix | Delete
|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_10]['textinput']))
[1946] Fix | Delete
{
[1947] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_RSS_10;
[1948] Fix | Delete
}
[1949] Fix | Delete
if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['channel'])
[1950] Fix | Delete
|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['image'])
[1951] Fix | Delete
|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['item'])
[1952] Fix | Delete
|| isset($this->data['child'][SIMPLEPIE_NAMESPACE_RDF]['RDF'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_090]['textinput']))
[1953] Fix | Delete
{
[1954] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_RSS_090;
[1955] Fix | Delete
}
[1956] Fix | Delete
}
[1957] Fix | Delete
elseif (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss']))
[1958] Fix | Delete
{
[1959] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_RSS_ALL;
[1960] Fix | Delete
if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
[1961] Fix | Delete
{
[1962] Fix | Delete
switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['attribs']['']['version']))
[1963] Fix | Delete
{
[1964] Fix | Delete
case '0.91':
[1965] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091;
[1966] Fix | Delete
if (isset($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
[1967] Fix | Delete
{
[1968] Fix | Delete
switch (trim($this->data['child'][SIMPLEPIE_NAMESPACE_RSS_20]['rss'][0]['child'][SIMPLEPIE_NAMESPACE_RSS_20]['skiphours']['hour'][0]['data']))
[1969] Fix | Delete
{
[1970] Fix | Delete
case '0':
[1971] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_NETSCAPE;
[1972] Fix | Delete
break;
[1973] Fix | Delete
[1974] Fix | Delete
case '24':
[1975] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_RSS_091_USERLAND;
[1976] Fix | Delete
break;
[1977] Fix | Delete
}
[1978] Fix | Delete
}
[1979] Fix | Delete
break;
[1980] Fix | Delete
[1981] Fix | Delete
case '0.92':
[1982] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_RSS_092;
[1983] Fix | Delete
break;
[1984] Fix | Delete
[1985] Fix | Delete
case '0.93':
[1986] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_RSS_093;
[1987] Fix | Delete
break;
[1988] Fix | Delete
[1989] Fix | Delete
case '0.94':
[1990] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_RSS_094;
[1991] Fix | Delete
break;
[1992] Fix | Delete
[1993] Fix | Delete
case '2.0':
[1994] Fix | Delete
$this->data['type'] &= SIMPLEPIE_TYPE_RSS_20;
[1995] Fix | Delete
break;
[1996] Fix | Delete
}
[1997] Fix | Delete
}
[1998] Fix | Delete
}
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function