]> git.mxchange.org Git - friendica.git/blobdiff - include/network.php
API: Better use "about" instead of "pdesc"
[friendica.git] / include / network.php
index e9cfe86035c5836461f417073a3ae4353c84b318..16c8185e1abb48b0fec1ada966fe06a0e9ffce35 100644 (file)
@@ -1,13 +1,12 @@
 <?php
-
 /**
  * @file include/network.php
  */
-
 use Friendica\App;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Network\Probe;
+use Friendica\Object\Image;
 use Friendica\Util\XML;
 
 /**
@@ -127,8 +126,8 @@ function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = array())
        if (x($opts, 'timeout')) {
                @curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
        } else {
-               $curl_time = intval(Config::get('system', 'curl_timeout'));
-               @curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
+               $curl_time = Config::get('system', 'curl_timeout', 60);
+               @curl_setopt($ch, CURLOPT_TIMEOUT, intval($curl_time));
        }
 
        // by default we will allow self-signed certs
@@ -303,8 +302,8 @@ function post_url($url, $params, $headers = null, &$redirects = 0, $timeout = 0)
        if (intval($timeout)) {
                curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
        } else {
-               $curl_time = intval(Config::get('system', 'curl_timeout'));
-               curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
+               $curl_time = Config::get('system', 'curl_timeout', 60);
+               curl_setopt($ch, CURLOPT_TIMEOUT, intval($curl_time));
        }
 
        if (defined('LIGHTTPD')) {
@@ -414,7 +413,7 @@ function xml_status($st, $message = '')
 
        $xmldata = array("result" => $result);
 
-       echo XML::from_array($xmldata, $xml);
+       echo XML::fromArray($xmldata, $xml);
 
        killme();
 }
@@ -687,7 +686,6 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
        $matches = null;
        $c = preg_match_all('/\[img.*?\](.*?)\[\/img\]/ism', $s, $matches, PREG_SET_ORDER);
        if ($c) {
-               require_once 'include/Photo.php';
                foreach ($matches as $mtch) {
                        logger('scale_external_image: ' . $mtch[1]);
 
@@ -712,18 +710,18 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
                        }
 
                        // guess mimetype from headers or filename
-                       $type = guess_image_type($mtch[1], true);
+                       $type = Image::guessType($mtch[1], true);
 
                        if ($i) {
-                               $ph = new Photo($i, $type);
-                               if ($ph->is_valid()) {
-                                       $orig_width = $ph->getWidth();
-                                       $orig_height = $ph->getHeight();
+                               $Image = new Image($i, $type);
+                               if ($Image->isValid()) {
+                                       $orig_width = $Image->getWidth();
+                                       $orig_height = $Image->getHeight();
 
                                        if ($orig_width > 640 || $orig_height > 640) {
-                                               $ph->scaleImage(640);
-                                               $new_width = $ph->getWidth();
-                                               $new_height = $ph->getHeight();
+                                               $Image->scaleDown(640);
+                                               $new_width = $Image->getWidth();
+                                               $new_height = $Image->getHeight();
                                                logger('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
                                                $s = str_replace(
                                                        $mtch[0],