mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 08:15:55 +00:00
hide uninteresting errors in several DOMDocument->loadHTML() invocations
This commit is contained in:
@@ -286,7 +286,7 @@ class DiskCache {
|
|||||||
if (!$res) return '';
|
if (!$res) return '';
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
if ($doc->loadHTML('<?xml encoding="UTF-8">' . $res)) {
|
if (@$doc->loadHTML('<?xml encoding="UTF-8">' . $res)) {
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
$cache = new DiskCache("images");
|
$cache = new DiskCache("images");
|
||||||
|
|
||||||
|
|||||||
@@ -1930,7 +1930,7 @@ class Feeds extends Handler_Protected {
|
|||||||
$feedUrls = [];
|
$feedUrls = [];
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
if ($doc->loadHTML($content)) {
|
if (@$doc->loadHTML($content)) {
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
$entries = $xpath->query('/html/head/link[@rel="alternate" and '.
|
$entries = $xpath->query('/html/head/link[@rel="alternate" and '.
|
||||||
'(contains(@type,"rss") or contains(@type,"atom"))]|/html/head/link[@rel="feed"]');
|
'(contains(@type,"rss") or contains(@type,"atom"))]|/html/head/link[@rel="feed"]');
|
||||||
|
|||||||
@@ -1341,9 +1341,9 @@ class RSSUtils {
|
|||||||
static function cache_media($html, $site_url) {
|
static function cache_media($html, $site_url) {
|
||||||
$cache = new DiskCache("images");
|
$cache = new DiskCache("images");
|
||||||
|
|
||||||
if ($cache->isWritable()) {
|
if ($html && $cache->isWritable()) {
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
if ($doc->loadHTML($html)) {
|
if (@$doc->loadHTML($html)) {
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
|
|
||||||
$entries = $xpath->query('(//img[@src]|//source[@src|@srcset]|//video[@poster|@src])');
|
$entries = $xpath->query('(//img[@src]|//source[@src|@srcset]|//video[@poster|@src])');
|
||||||
@@ -1829,7 +1829,7 @@ class RSSUtils {
|
|||||||
if ($html = @UrlHelper::fetch($url)) {
|
if ($html = @UrlHelper::fetch($url)) {
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
if ($doc->loadHTML($html)) {
|
if (@$doc->loadHTML($html)) {
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
|
|
||||||
$base = $xpath->query('/html/head/base[@href]');
|
$base = $xpath->query('/html/head/base[@href]');
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class Af_RedditImgur extends Plugin {
|
|||||||
if ($oembed_result && isset($oembed_result["html"])) {
|
if ($oembed_result && isset($oembed_result["html"])) {
|
||||||
|
|
||||||
$tmp = new DOMDocument();
|
$tmp = new DOMDocument();
|
||||||
if ($tmp->loadHTML('<?xml encoding="utf-8" ?>' . $oembed_result["html"])) {
|
if (@$tmp->loadHTML('<?xml encoding="utf-8" ?>' . $oembed_result["html"])) {
|
||||||
$p = $doc->createElement("p");
|
$p = $doc->createElement("p");
|
||||||
|
|
||||||
$p->appendChild($doc->importNode(
|
$p->appendChild($doc->importNode(
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class Cache_Starred_Images extends Plugin {
|
|||||||
$has_images = false;
|
$has_images = false;
|
||||||
$success = false;
|
$success = false;
|
||||||
|
|
||||||
if ($doc->loadHTML('<?xml encoding="UTF-8">' . $content)) {
|
if (@$doc->loadHTML('<?xml encoding="UTF-8">' . $content)) {
|
||||||
$xpath = new DOMXPath($doc);
|
$xpath = new DOMXPath($doc);
|
||||||
$entries = $xpath->query('(//img[@src])|(//video/source[@src])');
|
$entries = $xpath->query('(//img[@src])|(//video/source[@src])');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user