diff --git a/vendor/andreskrey/Readability/Configuration.php b/plugins/af_readability/vendor/andreskrey/Readability/Configuration.php similarity index 100% rename from vendor/andreskrey/Readability/Configuration.php rename to plugins/af_readability/vendor/andreskrey/Readability/Configuration.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMAttr.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMAttr.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMAttr.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMAttr.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMCdataSection.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMCdataSection.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMCdataSection.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMCdataSection.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMCharacterData.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMCharacterData.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMCharacterData.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMCharacterData.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMComment.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMComment.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMComment.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMComment.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMDocument.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMDocument.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMDocument.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMDocument.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMDocumentFragment.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMDocumentFragment.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMDocumentFragment.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMDocumentFragment.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMDocumentType.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMDocumentType.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMDocumentType.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMDocumentType.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMElement.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMElement.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMElement.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMElement.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMEntity.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMEntity.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMEntity.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMEntity.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMEntityReference.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMEntityReference.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMEntityReference.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMEntityReference.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMNode.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMNode.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMNode.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMNode.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMNotation.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMNotation.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMNotation.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMNotation.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMProcessingInstruction.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMProcessingInstruction.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMProcessingInstruction.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMProcessingInstruction.php diff --git a/vendor/andreskrey/Readability/Nodes/DOM/DOMText.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMText.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/DOM/DOMText.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/DOM/DOMText.php diff --git a/vendor/andreskrey/Readability/Nodes/NodeTrait.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/NodeTrait.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/NodeTrait.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/NodeTrait.php diff --git a/vendor/andreskrey/Readability/Nodes/NodeUtility.php b/plugins/af_readability/vendor/andreskrey/Readability/Nodes/NodeUtility.php similarity index 100% rename from vendor/andreskrey/Readability/Nodes/NodeUtility.php rename to plugins/af_readability/vendor/andreskrey/Readability/Nodes/NodeUtility.php diff --git a/vendor/andreskrey/Readability/ParseException.php b/plugins/af_readability/vendor/andreskrey/Readability/ParseException.php similarity index 100% rename from vendor/andreskrey/Readability/ParseException.php rename to plugins/af_readability/vendor/andreskrey/Readability/ParseException.php diff --git a/vendor/andreskrey/Readability/Readability.php b/plugins/af_readability/vendor/andreskrey/Readability/Readability.php similarity index 100% rename from vendor/andreskrey/Readability/Readability.php rename to plugins/af_readability/vendor/andreskrey/Readability/Readability.php diff --git a/plugins/af_redditimgur/init.php b/plugins/af_redditimgur/init.php index 9ab2e7968..403db888a 100755 --- a/plugins/af_redditimgur/init.php +++ b/plugins/af_redditimgur/init.php @@ -1,7 +1,4 @@ get_content_type($url, $useragent_compat); if ($content_type && strpos($content_type, "text/html") !== FALSE) { - $tmp = fetch_file_contents(["url" => $url, - "useragent" => $useragent_compat, - "http_accept" => "text/html"]); + foreach ($this->host->get_hooks(PluginHost::HOOK_GET_FULL_TEXT) as $p) { + $extracted_content = $p->hook_get_full_text($url); - Debug::log("tmplen: " . mb_strlen($tmp), Debug::$LOG_VERBOSE); - - if ($tmp && mb_strlen($tmp) < 1024 * 500) { - - $r = new Readability(new Configuration()); - - try { - if ($r->parse($tmp)) { - - $tmpxpath = new DOMXPath($r->getDOMDocument()); - - $entries = $tmpxpath->query('(//a[@href]|//img[@src])'); - - foreach ($entries as $entry) { - if ($entry->hasAttribute("href")) { - $entry->setAttribute("href", - rewrite_relative_url($url, $entry->getAttribute("href"))); - - } - - if ($entry->hasAttribute("src")) { - $entry->setAttribute("src", - rewrite_relative_url($url, $entry->getAttribute("src"))); - - } - - } - - $article["content"] = $r->getContent() . "