]> git.wh0rd.org - tt-rss.git/blobdiff - include/rssfuncs.php
image cache: do not try to cache data: schema urls; add caching of html5 video conten...
[tt-rss.git] / include / rssfuncs.php
index 6c342971fc9b73bc93094cdeb3633d1f0be9649c..1f38091b6126dc64c84d1aa7dfd37e4f75bb0ea0 100644 (file)
                                if ($feed_hub_url && $feed_self_url && function_exists('curl_init') &&
                                        !ini_get("open_basedir")) {
 
-                                       require_once 'lib/pubsubhubbub/subscriber.php';
+                                       require_once 'lib/pubsubhubbub/Subscriber.php';
 
                                        $callback_url = get_self_url_prefix() .
                                                "/public.php?op=pubsub&id=$feed";
 
-                                       $s = new Subscriber($feed_hub_url, $callback_url);
+                                       $s = new Pubsubhubbub\Subscriber\Subscriber($feed_hub_url, $callback_url);
 
                                        $rc = $s->subscribe($feed_self_url);
 
                                                                "/public.php?op=rss&id=-2&key=" .
                                                                get_feed_access_key(-2, false, $owner_uid);
 
-                                                       $p = new Publisher(PUBSUBHUBBUB_HUB);
+                                                       $p = new pubsubhubbub\publisher\Publisher(PUBSUBHUBBUB_HUB);
 
                                                        /* $pubsub_result = */ $p->publish_update($rss_link);
                                                }
                $doc->loadHTML($charset_hack . $html);
                $xpath = new DOMXPath($doc);
 
-               $entries = $xpath->query('(//img[@src])');
+               $entries = $xpath->query('(//img[@src])|(//video/source[@src])');
 
                foreach ($entries as $entry) {
-                       if ($entry->hasAttribute('src')) {
+                       if ($entry->hasAttribute('src') && strpos($entry->getAttribute('src'), "data:") !== 0) {
                                $src = rewrite_relative_url($site_url, $entry->getAttribute('src'));
 
-                               $local_filename = CACHE_DIR . "/images/" . sha1($src) . ".png";
+                               $extension = $entry->tagName == 'source' ? '.mp4' : '.png';
+                               $local_filename = CACHE_DIR . "/images/" . sha1($src) . $extension;
 
                                if ($debug) _debug("cache_images: downloading: $src to $local_filename");