]> git.mxchange.org Git - friendica.git/blobdiff - src/ParseUrl.php
Config now works with the new database routines
[friendica.git] / src / ParseUrl.php
index 943725ffe0819df55c4e2055f3bc87c5aa8e6abb..9e21736a8465883f14961f6f17a52c5681117b5e 100644 (file)
@@ -9,6 +9,11 @@ namespace Friendica;
 
 use Friendica\Core\Config;
 
+use xml;
+
+use DomXPath;
+use DOMDocument;
+
 require_once("include/network.php");
 require_once("include/Photo.php");
 require_once("include/oembed.php");
@@ -150,6 +155,12 @@ class ParseUrl {
                        @curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
                }
 
+               $range = intval(Config::get('system', 'curl_range_bytes', 0));
+
+               if ($range > 0) {
+                       curl_setopt($ch, CURLOPT_RANGE, '0-' . $range);
+               }
+
                $header = curl_exec($ch);
                $curl_info = @curl_getinfo($ch);
                curl_close($ch);
@@ -223,22 +234,22 @@ class ParseUrl {
 
                $body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
 
-               $doc = new \DOMDocument();
+               $doc = new DOMDocument();
                @$doc->loadHTML($body);
 
-               \xml::deleteNode($doc, "style");
-               \xml::deleteNode($doc, "script");
-               \xml::deleteNode($doc, "option");
-               \xml::deleteNode($doc, "h1");
-               \xml::deleteNode($doc, "h2");
-               \xml::deleteNode($doc, "h3");
-               \xml::deleteNode($doc, "h4");
-               \xml::deleteNode($doc, "h5");
-               \xml::deleteNode($doc, "h6");
-               \xml::deleteNode($doc, "ol");
-               \xml::deleteNode($doc, "ul");
-
-               $xpath = new \DomXPath($doc);
+               xml::deleteNode($doc, "style");
+               xml::deleteNode($doc, "script");
+               xml::deleteNode($doc, "option");
+               xml::deleteNode($doc, "h1");
+               xml::deleteNode($doc, "h2");
+               xml::deleteNode($doc, "h3");
+               xml::deleteNode($doc, "h4");
+               xml::deleteNode($doc, "h5");
+               xml::deleteNode($doc, "h6");
+               xml::deleteNode($doc, "ol");
+               xml::deleteNode($doc, "ul");
+
+               $xpath = new DomXPath($doc);
 
                $list = $xpath->query("//meta[@content]");
                foreach ($list as $node) {