Correction of the feed mechanism (Simplepie)
parent
3072457fb3
commit
7d9d1e8960
|
|
@ -90,7 +90,7 @@ class SimplePie
|
||||||
|
|
||||||
public function feed_url($url)
|
public function feed_url($url)
|
||||||
{
|
{
|
||||||
$this->rss_url = SimplePie_Misc::fix_protocol($url, 1);
|
$this->rss_url = (new SimplePie_Misc)->fix_protocol($url, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set_file(&$file)
|
public function set_file(&$file)
|
||||||
|
|
@ -147,7 +147,7 @@ class SimplePie
|
||||||
|
|
||||||
public function set_cache_class($class = 'SimplePie_Cache')
|
public function set_cache_class($class = 'SimplePie_Cache')
|
||||||
{
|
{
|
||||||
if (SimplePie_Misc::is_a_class($class, 'SimplePie_Cache')) {
|
if ((new SimplePie_Misc)->is_a_class($class, 'SimplePie_Cache')) {
|
||||||
$this->cache_class = $class;
|
$this->cache_class = $class;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -156,7 +156,7 @@ class SimplePie
|
||||||
|
|
||||||
public function set_locator_class($class = 'SimplePie_Locator')
|
public function set_locator_class($class = 'SimplePie_Locator')
|
||||||
{
|
{
|
||||||
if (SimplePie_Misc::is_a_class($class, 'SimplePie_Locator')) {
|
if ((new SimplePie_Misc)->is_a_class($class, 'SimplePie_Locator')) {
|
||||||
$this->locator_class = $class;
|
$this->locator_class = $class;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -165,7 +165,7 @@ class SimplePie
|
||||||
|
|
||||||
public function set_parser_class($class = 'SimplePie_Parser')
|
public function set_parser_class($class = 'SimplePie_Parser')
|
||||||
{
|
{
|
||||||
if (SimplePie_Misc::is_a_class($class, 'SimplePie_Parser')) {
|
if ((new SimplePie_Misc)->is_a_class($class, 'SimplePie_Parser')) {
|
||||||
$this->parser_class = $class;
|
$this->parser_class = $class;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +174,7 @@ class SimplePie
|
||||||
|
|
||||||
public function set_file_class($class = 'SimplePie_File')
|
public function set_file_class($class = 'SimplePie_File')
|
||||||
{
|
{
|
||||||
if (SimplePie_Misc::is_a_class($class, 'SimplePie_File')) {
|
if ((new SimplePie_Misc)->is_a_class($class, 'SimplePie_File')) {
|
||||||
$this->file_class = $class;
|
$this->file_class = $class;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -298,7 +298,7 @@ class SimplePie
|
||||||
if (get_magic_quotes_gpc()) {
|
if (get_magic_quotes_gpc()) {
|
||||||
$_GET[$this->sanitize->bypass_image_hotlink] = stripslashes($_GET[$this->sanitize->bypass_image_hotlink]);
|
$_GET[$this->sanitize->bypass_image_hotlink] = stripslashes($_GET[$this->sanitize->bypass_image_hotlink]);
|
||||||
}
|
}
|
||||||
SimplePie_Misc::display_file($_GET[$this->sanitize->bypass_image_hotlink], 10, $this->useragent);
|
(new SimplePie_Misc)->display_file($_GET[$this->sanitize->bypass_image_hotlink], 10, $this->useragent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET['js'])) {
|
if (isset($_GET['js'])) {
|
||||||
|
|
@ -421,13 +421,13 @@ EOT;
|
||||||
if ($feed) {
|
if ($feed) {
|
||||||
if ($cache && !$cache->save(array('url' => $this->rss_url, 'feed_url' => $feed))) {
|
if ($cache && !$cache->save(array('url' => $this->rss_url, 'feed_url' => $feed))) {
|
||||||
$this->error = "$cache->name is not writeable";
|
$this->error = "$cache->name is not writeable";
|
||||||
SimplePie_Misc::error($this->error, E_USER_WARNING, __FILE__, __LINE__);
|
(new SimplePie_Misc)->error($this->error, E_USER_WARNING, __FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
$this->rss_url = $feed;
|
$this->rss_url = $feed;
|
||||||
return $this->init();
|
return $this->init();
|
||||||
} else {
|
} else {
|
||||||
$this->error = "A feed could not be found at $this->rss_url";
|
$this->error = "A feed could not be found at $this->rss_url";
|
||||||
SimplePie_Misc::error($this->error, E_USER_WARNING, __FILE__, __LINE__);
|
(new SimplePie_Misc)->error($this->error, E_USER_WARNING, __FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -478,7 +478,7 @@ EOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the encoding to UTF-8 (as we always use UTF-8 internally)
|
// Change the encoding to UTF-8 (as we always use UTF-8 internally)
|
||||||
$data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8');
|
$data = (new SimplePie_Misc)->change_encoding($data, $encoding, 'UTF-8');
|
||||||
|
|
||||||
// Strip illegal characters (if on less than PHP5, as on PHP5 expat can manage fine)
|
// Strip illegal characters (if on less than PHP5, as on PHP5 expat can manage fine)
|
||||||
if (version_compare(phpversion(), '5', '<')) {
|
if (version_compare(phpversion(), '5', '<')) {
|
||||||
|
|
@ -487,7 +487,7 @@ EOT;
|
||||||
} elseif (function_exists('mb_convert_encoding')) {
|
} elseif (function_exists('mb_convert_encoding')) {
|
||||||
$data = mb_convert_encoding($data, 'UTF-8', 'UTF-8');
|
$data = mb_convert_encoding($data, 'UTF-8', 'UTF-8');
|
||||||
} else {
|
} else {
|
||||||
$data = SimplePie_Misc::utf8_bad_replace($data);
|
$data = (new SimplePie_Misc)->utf8_bad_replace($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -539,14 +539,14 @@ EOT;
|
||||||
// Cache the file if caching is enabled
|
// Cache the file if caching is enabled
|
||||||
if ($cache && !$cache->save($this->data)) {
|
if ($cache && !$cache->save($this->data)) {
|
||||||
$this->error = "$cache->name is not writeable";
|
$this->error = "$cache->name is not writeable";
|
||||||
SimplePie_Misc::error($this->error, E_USER_WARNING, __FILE__, __LINE__);
|
(new SimplePie_Misc)->error($this->error, E_USER_WARNING, __FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// If we have an error, just set SimplePie::error to it and quit
|
// If we have an error, just set SimplePie::error to it and quit
|
||||||
else {
|
else {
|
||||||
$this->error = "XML error: $data->error_string at line $data->current_line, column $data->current_column";
|
$this->error = "XML error: $data->error_string at line $data->current_line, column $data->current_column";
|
||||||
SimplePie_Misc::error($this->error, E_USER_WARNING, __FILE__, __LINE__);
|
(new SimplePie_Misc)->error($this->error, E_USER_WARNING, __FILE__, __LINE__);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -595,7 +595,7 @@ EOT;
|
||||||
public function get_favicon($check = false, $alternate = null)
|
public function get_favicon($check = false, $alternate = null)
|
||||||
{
|
{
|
||||||
if (!empty($this->data['info']['link']['alternate'][0])) {
|
if (!empty($this->data['info']['link']['alternate'][0])) {
|
||||||
$favicon = SimplePie_Misc::absolutize_url('/favicon.ico', $this->get_feed_link());
|
$favicon = (new SimplePie_Misc)->absolutize_url('/favicon.ico', $this->get_feed_link());
|
||||||
|
|
||||||
if ($check) {
|
if ($check) {
|
||||||
$file = new $this->file_class($favicon, $this->timeout/10, 5, null, $this->useragent, $this->force_fsockopen);
|
$file = new $this->file_class($favicon, $this->timeout/10, 5, null, $this->useragent, $this->force_fsockopen);
|
||||||
|
|
@ -628,7 +628,7 @@ EOT;
|
||||||
public function subscribe_feed()
|
public function subscribe_feed()
|
||||||
{
|
{
|
||||||
if (!empty($this->rss_url)) {
|
if (!empty($this->rss_url)) {
|
||||||
return SimplePie_Misc::fix_protocol($this->rss_url, 2);
|
return (new SimplePie_Misc)->fix_protocol($this->rss_url, 2);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -637,7 +637,7 @@ EOT;
|
||||||
public function subscribe_outlook()
|
public function subscribe_outlook()
|
||||||
{
|
{
|
||||||
if (!empty($this->rss_url)) {
|
if (!empty($this->rss_url)) {
|
||||||
return 'outlook' . SimplePie_Misc::fix_protocol($this->rss_url, 2);
|
return 'outlook' . (new SimplePie_Misc)->fix_protocol($this->rss_url, 2);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -646,7 +646,7 @@ EOT;
|
||||||
public function subscribe_podcast()
|
public function subscribe_podcast()
|
||||||
{
|
{
|
||||||
if (!empty($this->rss_url)) {
|
if (!empty($this->rss_url)) {
|
||||||
return SimplePie_Misc::fix_protocol($this->rss_url, 3);
|
return (new SimplePie_Misc)->fix_protocol($this->rss_url, 3);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1745,7 +1745,7 @@ class SimplePie_File
|
||||||
if (!is_array($headers)) {
|
if (!is_array($headers)) {
|
||||||
$headers = array();
|
$headers = array();
|
||||||
}
|
}
|
||||||
if (extension_loaded('curl') && version_compare(SimplePie_Misc::get_curl_version(), '7.10.5', '>=') && !$force_fsockopen) {
|
if (extension_loaded('curl') && version_compare((new SimplePie_Misc)->get_curl_version(), '7.10.5', '>=') && !$force_fsockopen) {
|
||||||
$this->method = 'curl';
|
$this->method = 'curl';
|
||||||
$fp = curl_init();
|
$fp = curl_init();
|
||||||
$headers2 = array();
|
$headers2 = array();
|
||||||
|
|
@ -1991,12 +1991,12 @@ class SimplePie_Misc
|
||||||
$relative = trim($relative);
|
$relative = trim($relative);
|
||||||
$base = trim($base);
|
$base = trim($base);
|
||||||
if (!empty($relative)) {
|
if (!empty($relative)) {
|
||||||
$relative = SimplePie_Misc::parse_url($relative, false);
|
$relative = (new SimplePie_Misc)->parse_url($relative, false);
|
||||||
$relative = array('scheme' => $relative[2], 'authority' => $relative[3], 'path' => $relative[5], 'query' => $relative[7], 'fragment' => $relative[9]);
|
$relative = array('scheme' => $relative[2], 'authority' => $relative[3], 'path' => $relative[5], 'query' => $relative[7], 'fragment' => $relative[9]);
|
||||||
if (!empty($relative['scheme'])) {
|
if (!empty($relative['scheme'])) {
|
||||||
$target = $relative;
|
$target = $relative;
|
||||||
} elseif (!empty($base)) {
|
} elseif (!empty($base)) {
|
||||||
$base = SimplePie_Misc::parse_url($base, false);
|
$base = (new SimplePie_Misc)->parse_url($base, false);
|
||||||
$base = array('scheme' => $base[2], 'authority' => $base[3], 'path' => $base[5], 'query' => $base[7], 'fragment' => $base[9]);
|
$base = array('scheme' => $base[2], 'authority' => $base[3], 'path' => $base[5], 'query' => $base[7], 'fragment' => $base[9]);
|
||||||
$target['scheme'] = $base['scheme'];
|
$target['scheme'] = $base['scheme'];
|
||||||
if (!empty($relative['authority'])) {
|
if (!empty($relative['authority'])) {
|
||||||
|
|
@ -2025,12 +2025,12 @@ class SimplePie_Misc
|
||||||
$input = substr($input, 2);
|
$input = substr($input, 2);
|
||||||
} elseif (strpos($input, '/./') === 0) {
|
} elseif (strpos($input, '/./') === 0) {
|
||||||
$input = substr_replace($input, '/', 0, 3);
|
$input = substr_replace($input, '/', 0, 3);
|
||||||
} elseif (strpos($input, '/.') === 0 && SimplePie_Misc::strendpos($input, '/.') === 0) {
|
} elseif (strpos($input, '/.') === 0 && (new SimplePie_Misc)->strendpos($input, '/.') === 0) {
|
||||||
$input = substr_replace($input, '/', -2);
|
$input = substr_replace($input, '/', -2);
|
||||||
} elseif (strpos($input, '/../') === 0) {
|
} elseif (strpos($input, '/../') === 0) {
|
||||||
$input = substr_replace($input, '/', 0, 4);
|
$input = substr_replace($input, '/', 0, 4);
|
||||||
$target['path'] = preg_replace('/(\/)?([^\/]+)$/msiU', '', $target['path']);
|
$target['path'] = preg_replace('/(\/)?([^\/]+)$/msiU', '', $target['path']);
|
||||||
} elseif (strpos($input, '/..') === 0 && SimplePie_Misc::strendpos($input, '/..') === 0) {
|
} elseif (strpos($input, '/..') === 0 && (new SimplePie_Misc)->strendpos($input, '/..') === 0) {
|
||||||
$input = substr_replace($input, '/', 0, 3);
|
$input = substr_replace($input, '/', 0, 3);
|
||||||
$target['path'] = preg_replace('/(\/)?([^\/]+)$/msiU', '', $target['path']);
|
$target['path'] = preg_replace('/(\/)?([^\/]+)$/msiU', '', $target['path']);
|
||||||
} elseif ($input == '.' || $input == '..') {
|
} elseif ($input == '.' || $input == '..') {
|
||||||
|
|
@ -2163,12 +2163,12 @@ class SimplePie_Misc
|
||||||
|
|
||||||
public function fix_protocol($url, $http = 1)
|
public function fix_protocol($url, $http = 1)
|
||||||
{
|
{
|
||||||
$parsed = SimplePie_Misc::parse_url($url);
|
$parsed = (new SimplePie_Misc)->parse_url($url);
|
||||||
if (!empty($parsed['scheme']) && strtolower($parsed['scheme']) != 'http' && strtolower($parsed['scheme']) != 'https') {
|
if (!empty($parsed['scheme']) && strtolower($parsed['scheme']) != 'http' && strtolower($parsed['scheme']) != 'https') {
|
||||||
return SimplePie_Misc::fix_protocol("$parsed[authority]$parsed[path]$parsed[query]$parsed[fragment]", $http);
|
return (new SimplePie_Misc)->fix_protocol("$parsed[authority]$parsed[path]$parsed[query]$parsed[fragment]", $http);
|
||||||
}
|
}
|
||||||
if (!file_exists($url) && empty($parsed['scheme'])) {
|
if (!file_exists($url) && empty($parsed['scheme'])) {
|
||||||
return SimplePie_Misc::fix_protocol("http://$url", $http);
|
return (new SimplePie_Misc)->fix_protocol("http://$url", $http);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($http == 2 && !empty($parsed['scheme'])) {
|
if ($http == 2 && !empty($parsed['scheme'])) {
|
||||||
|
|
@ -2233,8 +2233,8 @@ class SimplePie_Misc
|
||||||
|
|
||||||
public function change_encoding($data, $input, $output)
|
public function change_encoding($data, $input, $output)
|
||||||
{
|
{
|
||||||
$input = SimplePie_Misc::encoding($input);
|
$input = (new SimplePie_Misc)->encoding($input);
|
||||||
$output = SimplePie_Misc::encoding($output);
|
$output = (new SimplePie_Misc)->encoding($output);
|
||||||
|
|
||||||
if ($input != $output) {
|
if ($input != $output) {
|
||||||
if (function_exists('iconv') && $input['use_iconv'] && $output['use_iconv'] && iconv($input['encoding'], "$output[encoding]//TRANSLIT", $data)) {
|
if (function_exists('iconv') && $input['use_iconv'] && $output['use_iconv'] && iconv($input['encoding'], "$output[encoding]//TRANSLIT", $data)) {
|
||||||
|
|
@ -3117,13 +3117,13 @@ class SimplePie_Locator
|
||||||
|
|
||||||
public function autodiscovery(&$file)
|
public function autodiscovery(&$file)
|
||||||
{
|
{
|
||||||
$links = SimplePie_Misc::get_element('link', $file->body());
|
$links = (new SimplePie_Misc)->get_element('link', $file->body());
|
||||||
$done = array();
|
$done = array();
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
if (!empty($link['attribs']['TYPE']['data']) && !empty($link['attribs']['HREF']['data']) && !empty($link['attribs']['REL']['data'])) {
|
if (!empty($link['attribs']['TYPE']['data']) && !empty($link['attribs']['HREF']['data']) && !empty($link['attribs']['REL']['data'])) {
|
||||||
$rel = preg_split('/\s+/', strtolower(trim($link['attribs']['REL']['data'])));
|
$rel = preg_split('/\s+/', strtolower(trim($link['attribs']['REL']['data'])));
|
||||||
$type = preg_match('/^(application\/rss\+xml|application\/atom\+xml|application\/rdf\+xml|application\/xml\+rss|application\/xml\+atom|application\/xml\+rdf|application\/xml|application\/x\.atom\+xml|text\/xml)(;|$)/msiU', trim($link['attribs']['TYPE']['data']));
|
$type = preg_match('/^(application\/rss\+xml|application\/atom\+xml|application\/rdf\+xml|application\/xml\+rss|application\/xml\+atom|application\/xml\+rdf|application\/xml|application\/x\.atom\+xml|text\/xml)(;|$)/msiU', trim($link['attribs']['TYPE']['data']));
|
||||||
$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['HREF']['data']), $this->file->url);
|
$href = (new SimplePie_Misc)->absolutize_url(trim($link['attribs']['HREF']['data']), $this->file->url);
|
||||||
if (!in_array($href, $done) && in_array('alternate', $rel) && $type) {
|
if (!in_array($href, $done) && in_array('alternate', $rel) && $type) {
|
||||||
$feed = $this->is_feed($href);
|
$feed = $this->is_feed($href);
|
||||||
if ($feed) {
|
if ($feed) {
|
||||||
|
|
@ -3138,17 +3138,17 @@ class SimplePie_Locator
|
||||||
|
|
||||||
public function get_links(&$file)
|
public function get_links(&$file)
|
||||||
{
|
{
|
||||||
$links = SimplePie_Misc::get_element('a', $file->body());
|
$links = (new SimplePie_Misc)->get_element('a', $file->body());
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
if (!empty($link['attribs']['HREF']['data'])) {
|
if (!empty($link['attribs']['HREF']['data'])) {
|
||||||
$href = trim($link['attribs']['HREF']['data']);
|
$href = trim($link['attribs']['HREF']['data']);
|
||||||
$parsed = SimplePie_Misc::parse_url($href);
|
$parsed = (new SimplePie_Misc)->parse_url($href);
|
||||||
if (empty($parsed['scheme']) || $parsed['scheme'] != 'javascript') {
|
if (empty($parsed['scheme']) || $parsed['scheme'] != 'javascript') {
|
||||||
$current = SimplePie_Misc::parse_url($this->file->url);
|
$current = (new SimplePie_Misc)->parse_url($this->file->url);
|
||||||
if (empty($parsed['authority']) || $parsed['authority'] == $current['authority']) {
|
if (empty($parsed['authority']) || $parsed['authority'] == $current['authority']) {
|
||||||
$this->local[] = SimplePie_Misc::absolutize_url($href, $this->file->url);
|
$this->local[] = (new SimplePie_Misc)->absolutize_url($href, $this->file->url);
|
||||||
} else {
|
} else {
|
||||||
$this->elsewhere[] = SimplePie_Misc::absolutize_url($href, $this->file->url);
|
$this->elsewhere[] = (new SimplePie_Misc)->absolutize_url($href, $this->file->url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3168,7 +3168,7 @@ class SimplePie_Locator
|
||||||
public function extension(&$array)
|
public function extension(&$array)
|
||||||
{
|
{
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
$value = SimplePie_Misc::absolutize_url($value, $this->file->url);
|
$value = (new SimplePie_Misc)->absolutize_url($value, $this->file->url);
|
||||||
if (in_array(strrchr($value, '.'), array('.rss', '.rdf', '.atom', '.xml'))) {
|
if (in_array(strrchr($value, '.'), array('.rss', '.rdf', '.atom', '.xml'))) {
|
||||||
if ($this->is_feed($value)) {
|
if ($this->is_feed($value)) {
|
||||||
return $value;
|
return $value;
|
||||||
|
|
@ -3183,7 +3183,7 @@ class SimplePie_Locator
|
||||||
public function body(&$array)
|
public function body(&$array)
|
||||||
{
|
{
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
$value = SimplePie_Misc::absolutize_url($value, $this->file->url);
|
$value = (new SimplePie_Misc)->absolutize_url($value, $this->file->url);
|
||||||
if (preg_match('/(rss|rdf|atom|xml)/i', $value)) {
|
if (preg_match('/(rss|rdf|atom|xml)/i', $value)) {
|
||||||
if ($this->is_feed($value)) {
|
if ($this->is_feed($value)) {
|
||||||
return $value;
|
return $value;
|
||||||
|
|
@ -3874,7 +3874,7 @@ class SimplePie_Sanitize
|
||||||
|
|
||||||
public function set_item_class($class = 'SimplePie_Item')
|
public function set_item_class($class = 'SimplePie_Item')
|
||||||
{
|
{
|
||||||
if (SimplePie_Misc::is_a_class($class, 'SimplePie_Item')) {
|
if ((new SimplePie_Misc)->is_a_class($class, 'SimplePie_Item')) {
|
||||||
$this->item_class = $class;
|
$this->item_class = $class;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3883,7 +3883,7 @@ class SimplePie_Sanitize
|
||||||
|
|
||||||
public function set_author_class($class = 'SimplePie_Author')
|
public function set_author_class($class = 'SimplePie_Author')
|
||||||
{
|
{
|
||||||
if (SimplePie_Misc::is_a_class($class, 'SimplePie_Author')) {
|
if ((new SimplePie_Misc)->is_a_class($class, 'SimplePie_Author')) {
|
||||||
$this->author_class = $class;
|
$this->author_class = $class;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3892,7 +3892,7 @@ class SimplePie_Sanitize
|
||||||
|
|
||||||
public function set_enclosure_class($class = 'SimplePie_Enclosure')
|
public function set_enclosure_class($class = 'SimplePie_Enclosure')
|
||||||
{
|
{
|
||||||
if (SimplePie_Misc::is_a_class($class, 'SimplePie_Enclosure')) {
|
if ((new SimplePie_Misc)->is_a_class($class, 'SimplePie_Enclosure')) {
|
||||||
$this->enclosure_class = $class;
|
$this->enclosure_class = $class;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -3914,7 +3914,7 @@ class SimplePie_Sanitize
|
||||||
}
|
}
|
||||||
// FeedBurner feeds use alternate link
|
// FeedBurner feeds use alternate link
|
||||||
elseif (strpos($url, 'http://feeds.feedburner.com/') !== 0) {
|
elseif (strpos($url, 'http://feeds.feedburner.com/') !== 0) {
|
||||||
$this->feed_xmlbase = SimplePie_Misc::parse_url($url);
|
$this->feed_xmlbase = (new SimplePie_Misc)->parse_url($url);
|
||||||
if (empty($this->feed_xmlbase['authority'])) {
|
if (empty($this->feed_xmlbase['authority'])) {
|
||||||
$this->feed_xmlbase = preg_replace('/^' . preg_quote(realpath($_SERVER['DOCUMENT_ROOT']), '/') . '/', '', realpath($url));
|
$this->feed_xmlbase = preg_replace('/^' . preg_quote(realpath($_SERVER['DOCUMENT_ROOT']), '/') . '/', '', realpath($url));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -4023,9 +4023,9 @@ class SimplePie_Sanitize
|
||||||
|
|
||||||
// Item level xml:base
|
// Item level xml:base
|
||||||
if (!empty($item['attribs']['XML:BASE'])) {
|
if (!empty($item['attribs']['XML:BASE'])) {
|
||||||
$this->item_xmlbase = SimplePie_Misc::absolutize_url($item['attribs']['XML:BASE'], $this->feed_xmlbase);
|
$this->item_xmlbase = (new SimplePie_Misc)->absolutize_url($item['attribs']['XML:BASE'], $this->feed_xmlbase);
|
||||||
} elseif (!empty($item['attribs']['HTTP://WWW.W3.ORG/XML/1998/NAMESPACE:BASE'])) {
|
} elseif (!empty($item['attribs']['HTTP://WWW.W3.ORG/XML/1998/NAMESPACE:BASE'])) {
|
||||||
$this->item_xmlbase = SimplePie_Misc::absolutize_url($item['attribs']['HTTP://WWW.W3.ORG/XML/1998/NAMESPACE:BASE'], $this->feed_xmlbase);
|
$this->item_xmlbase = (new SimplePie_Misc)->absolutize_url($item['attribs']['HTTP://WWW.W3.ORG/XML/1998/NAMESPACE:BASE'], $this->feed_xmlbase);
|
||||||
} else {
|
} else {
|
||||||
$this->item_xmlbase = null;
|
$this->item_xmlbase = null;
|
||||||
}
|
}
|
||||||
|
|
@ -4259,7 +4259,7 @@ class SimplePie_Sanitize
|
||||||
|
|
||||||
// If Bypass Image Hotlink is enabled, rewrite all the image tags.
|
// If Bypass Image Hotlink is enabled, rewrite all the image tags.
|
||||||
if ($this->bypass_image_hotlink) {
|
if ($this->bypass_image_hotlink) {
|
||||||
$images = SimplePie_Misc::get_element('img', $data);
|
$images = (new SimplePie_Misc)->get_element('img', $data);
|
||||||
foreach ($images as $img) {
|
foreach ($images as $img) {
|
||||||
if (!empty($img['attribs']['SRC']['data'])) {
|
if (!empty($img['attribs']['SRC']['data'])) {
|
||||||
$pre = '';
|
$pre = '';
|
||||||
|
|
@ -4268,7 +4268,7 @@ class SimplePie_Sanitize
|
||||||
}
|
}
|
||||||
$pre .= "?$this->bypass_image_hotlink=";
|
$pre .= "?$this->bypass_image_hotlink=";
|
||||||
$img['attribs']['SRC']['data'] = $pre . rawurlencode(strtr($img['attribs']['SRC']['data'], array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES))));
|
$img['attribs']['SRC']['data'] = $pre . rawurlencode(strtr($img['attribs']['SRC']['data'], array_flip(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES))));
|
||||||
$data = str_replace($img['full'], SimplePie_Misc::element_implode($img), $data);
|
$data = str_replace($img['full'], (new SimplePie_Misc)->element_implode($img), $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4291,7 +4291,7 @@ class SimplePie_Sanitize
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert encoding
|
// Convert encoding
|
||||||
$data = SimplePie_Misc::change_encoding($data, $this->input_encoding, $this->output_encoding);
|
$data = (new SimplePie_Misc)->change_encoding($data, $this->input_encoding, $this->output_encoding);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
@ -4324,9 +4324,9 @@ class SimplePie_Sanitize
|
||||||
}
|
}
|
||||||
if (!empty($xmlbase)) {
|
if (!empty($xmlbase)) {
|
||||||
if (!empty($this->item_xmlbase)) {
|
if (!empty($this->item_xmlbase)) {
|
||||||
$xmlbase = SimplePie_Misc::absolutize_url($xmlbase, $this->item_xmlbase);
|
$xmlbase = (new SimplePie_Misc)->absolutize_url($xmlbase, $this->item_xmlbase);
|
||||||
} else {
|
} else {
|
||||||
$xmlbase = SimplePie_Misc::absolutize_url($xmlbase, $this->feed_xmlbase);
|
$xmlbase = (new SimplePie_Misc)->absolutize_url($xmlbase, $this->feed_xmlbase);
|
||||||
}
|
}
|
||||||
} elseif (!empty($this->item_xmlbase)) {
|
} elseif (!empty($this->item_xmlbase)) {
|
||||||
$xmlbase = $this->item_xmlbase;
|
$xmlbase = $this->item_xmlbase;
|
||||||
|
|
@ -4335,7 +4335,7 @@ class SimplePie_Sanitize
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($raw_url) {
|
if ($raw_url) {
|
||||||
return SimplePie_Misc::absolutize_url($data, $xmlbase);
|
return (new SimplePie_Misc)->absolutize_url($data, $xmlbase);
|
||||||
} else {
|
} else {
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'background',
|
'background',
|
||||||
|
|
@ -4353,7 +4353,7 @@ class SimplePie_Sanitize
|
||||||
);
|
);
|
||||||
foreach ($attributes as $attribute) {
|
foreach ($attributes as $attribute) {
|
||||||
if (preg_match("/$attribute='(.*)'/siU", $data[0], $attrib) || preg_match("/$attribute=\"(.*)\"/siU", $data[0], $attrib) || preg_match("/$attribute=(.*)[ |\/|>]/siU", $data[0], $attrib)) {
|
if (preg_match("/$attribute='(.*)'/siU", $data[0], $attrib) || preg_match("/$attribute=\"(.*)\"/siU", $data[0], $attrib) || preg_match("/$attribute=(.*)[ |\/|>]/siU", $data[0], $attrib)) {
|
||||||
$new_tag = str_replace($attrib[1], SimplePie_Misc::absolutize_url($attrib[1], $xmlbase), $attrib[0]);
|
$new_tag = str_replace($attrib[1], (new SimplePie_Misc)->absolutize_url($attrib[1], $xmlbase), $attrib[0]);
|
||||||
$data[0] = str_replace($attrib[0], $new_tag, $data[0]);
|
$data[0] = str_replace($attrib[0], $new_tag, $data[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4371,9 +4371,9 @@ class SimplePie_Sanitize
|
||||||
if (isset($this->cached_entities[$data[0]])) {
|
if (isset($this->cached_entities[$data[0]])) {
|
||||||
return $this->cached_entities[$data[0]];
|
return $this->cached_entities[$data[0]];
|
||||||
} else {
|
} else {
|
||||||
$return = SimplePie_Misc::change_encoding(html_entity_decode($data[0], ENT_QUOTES), 'ISO-8859-1', $this->input_encoding);
|
$return = (new SimplePie_Misc)->change_encoding(html_entity_decode($data[0], ENT_QUOTES), 'ISO-8859-1', $this->input_encoding);
|
||||||
if ($return == $data[0]) {
|
if ($return == $data[0]) {
|
||||||
$return = SimplePie_Misc::change_encoding(preg_replace_callback('/&#([x]?[0-9a-f]+);/mi', array(&$this, 'replace_num_entity'), $data[0]), 'UTF-8', $this->input_encoding);
|
$return = (new SimplePie_Misc)->change_encoding(preg_replace_callback('/&#([x]?[0-9a-f]+);/mi', array(&$this, 'replace_num_entity'), $data[0]), 'UTF-8', $this->input_encoding);
|
||||||
}
|
}
|
||||||
$this->cached_entities[$data[0]] = $return;
|
$this->cached_entities[$data[0]] = $return;
|
||||||
return $return;
|
return $return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue