]> git.wh0rd.org - tt-rss.git/blobdiff - plugins/af_redditimgur/init.php
use print_hidden() for hidden dojo form fields
[tt-rss.git] / plugins / af_redditimgur / init.php
index e43846abfec11b672dbe080fbc32008d6f2e467d..b5b4cca346e7b6d2719bc45fc59b5af93b6f9835 100755 (executable)
@@ -46,9 +46,9 @@ class Af_RedditImgur extends Plugin {
                        }
                        </script>";
 
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
-               print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"af_redditimgur\">";
+               print_hidden("op", "pluginhandler");
+               print_hidden("method", "save");
+               print_hidden("plugin", "af_redditimgur");
 
                print "<p>" . __("Uses Readability (full-text-rss) implementation by <a target='_blank' href='https://bitbucket.org/fivefilters/'>FiveFilters.org</a>");
                print "<p/>";
@@ -106,7 +106,7 @@ class Af_RedditImgur extends Plugin {
                                                if ($oembed_result && isset($oembed_result["html"])) {
 
                                                        $tmp = new DOMDocument();
-                                                       if ($tmp->loadHTML($oembed_result["html"])) {
+                                                       if ($tmp->loadHTML('<?xml encoding="utf-8" ?>' . $oembed_result["html"])) {
                                                                $p = $doc->createElement("p");
 
                                                                $p->appendChild($doc->importNode(
@@ -152,6 +152,32 @@ class Af_RedditImgur extends Plugin {
                                        }
                                }
 
+                               if (!$found && preg_match("/https?:\/\/(www\.)?streamable.com\//i", $entry->getAttribute("href"))) {
+
+                                       _debug("Handling as Streamable", $debug);
+
+                                       $tmp = fetch_file_contents($entry->getAttribute("href"));
+
+                                       if ($tmp) {
+                                               $tmpdoc = new DOMDocument();
+
+                                               if (@$tmpdoc->loadHTML($tmp)) {
+                                                       $tmpxpath = new DOMXPath($tmpdoc);
+
+                                                       $source_node = $tmpxpath->query("//video[contains(@class,'video-player-tag')]//source[contains(@src, '.mp4')]")->item(0);
+                                                       $poster_node = $tmpxpath->query("//video[contains(@class,'video-player-tag') and @poster]")->item(0);
+
+                                                       if ($source_node && $poster_node) {
+                                                               $source_stream = $source_node->getAttribute("src");
+                                                               $poster_url = $poster_node->getAttribute("poster");
+
+                                                               $this->handle_as_video($doc, $entry, $source_stream, $poster_url);
+                                                               $found = 1;
+                                                       }
+                                               }
+                                       }
+                               }
+
                                // imgur .gif -> .gifv
                                if (!$found && preg_match("/i\.imgur\.com\/(.*?)\.gif$/i", $entry->getAttribute("href"))) {
                                        _debug("Handling as imgur gif (->gifv)", $debug);