summaryrefslogtreecommitdiff
path: root/include/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2019-08-14 08:25:09 +0300
committerAndrew Dolgov <[email protected]>2019-08-14 08:25:09 +0300
commit65450f8a2bbf325d26177c2589c3a9bbe67d8f80 (patch)
tree932b65b145294955ac4628cd9b0536c83c392ce6 /include/functions.php
parentb0fbae938dbc7c66c7829a86f7dd0fe6fb689908 (diff)
parentfdb6066bf67751ebb388a3de082d80f5444e3681 (diff)
Merge branch 'master' of git.tt-rss.org:fox/tt-rss
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php61
1 files changed, 0 insertions, 61 deletions
diff --git a/include/functions.php b/include/functions.php
index 80ae3fe7e..5a66e53b9 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1233,64 +1233,6 @@
return false;
}
- // check for locally cached (media) URLs and rewrite to local versions
- // this is called separately after sanitize() and plugin render article hooks to allow
- // plugins work on original source URLs used before caching
-
- function rewrite_cached_urls($str) {
- $res = trim($str); if (!$res) return '';
-
- $doc = new DOMDocument();
- $doc->loadHTML('<?xml encoding="UTF-8">' . $res);
- $xpath = new DOMXPath($doc);
-
- $entries = $xpath->query('(//img[@src]|//picture/source[@src]|//video[@poster]|//video/source[@src]|//audio/source[@src])');
-
- $need_saving = false;
-
- foreach ($entries as $entry) {
-
- if ($entry->hasAttribute('src') || $entry->hasAttribute('poster')) {
-
- // should be already absolutized because this is called after sanitize()
- $src = $entry->hasAttribute('poster') ? $entry->getAttribute('poster') : $entry->getAttribute('src');
- $cached_filename = CACHE_DIR . '/images/' . sha1($src);
-
- if (file_exists($cached_filename)) {
-
- // this is strictly cosmetic
- if ($entry->tagName == 'img') {
- $suffix = ".png";
- } else if ($entry->parentNode && $entry->parentNode->tagName == "picture") {
- $suffix = ".png";
- } else if ($entry->parentNode && $entry->parentNode->tagName == "video") {
- $suffix = ".mp4";
- } else if ($entry->parentNode && $entry->parentNode->tagName == "audio") {
- $suffix = ".ogg";
- } else {
- $suffix = "";
- }
-
- $src = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($src) . $suffix;
-
- if ($entry->hasAttribute('poster'))
- $entry->setAttribute('poster', $src);
- else
- $entry->setAttribute('src', $src);
-
- $need_saving = true;
- }
- }
- }
-
- if ($need_saving) {
- $doc->removeChild($doc->firstChild); //remove doctype
- $res = $doc->saveHTML();
- }
-
- return $res;
- }
-
function sanitize($str, $force_remove_images = false, $owner = false, $site_url = false, $highlight_words = false, $article_id = false) {
if (!$owner) $owner = $_SESSION["uid"];
@@ -1315,9 +1257,6 @@
if ($entry->hasAttribute('src')) {
$src = rewrite_relative_url($rewrite_base_url, $entry->getAttribute('src'));
-
- // cache stuff has gone to rewrite_cached_urls()
-
$entry->setAttribute('src', $src);
}