]> git.mxchange.org Git - friendica.git/blobdiff - mod/parse_url.php
Fix undefined var in module Proxy
[friendica.git] / mod / parse_url.php
index 331ebf2629edb0ff74a58f5628d815a31a0f53fb..14ec4d42ce45748ea89c8150655347616b92a7b5 100644 (file)
  * @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
  */
 use Friendica\App;
-use Friendica\Core\Addon;
+use Friendica\Core\Hook;
+use Friendica\Core\Logger;
 use Friendica\Util\Network;
 use Friendica\Util\ParseUrl;
 
-require_once 'include/items.php';
-
 function parse_url_content(App $a)
 {
        $text = null;
@@ -46,15 +45,15 @@ function parse_url_content(App $a)
 
        // Add url scheme if it is missing
        $arrurl = parse_url($url);
-       if (!x($arrurl, 'scheme')) {
-               if (x($arrurl, 'host')) {
+       if (empty($arrurl['scheme'])) {
+               if (!empty($arrurl['host'])) {
                        $url = 'http:' . $url;
                } else {
                        $url = 'http://' . $url;
                }
        }
 
-       logger($url);
+       Logger::log($url);
 
        // Check if the URL is an image, video or audio file. If so format
        // the URL with the corresponding BBCode media tag
@@ -73,6 +72,7 @@ function parse_url_content(App $a)
                                $hdrs[$k] = $v;
                        }
                }
+               $type = null;
                if (array_key_exists('Content-Type', $hdrs)) {
                        $type = $hdrs['Content-Type'];
                }
@@ -97,7 +97,7 @@ function parse_url_content(App $a)
 
        $arr = ['url' => $url, 'text' => ''];
 
-       Addon::callHooks('parse_link', $arr);
+       Hook::callAll('parse_link', $arr);
 
        if (strlen($arr['text'])) {
                echo $arr['text'];
@@ -113,7 +113,7 @@ function parse_url_content(App $a)
 
                $result = sprintf($template, $url, ($title) ? $title : $url, $text) . $str_tags;
 
-               logger('(unparsed): returns: ' . $result);
+               Logger::log('(unparsed): returns: ' . $result);
 
                echo $result;
                exit();