]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/ParseUrl.php
Use centralized function to fetch query results
[friendica.git] / src / Module / ParseUrl.php
index 7138238d85965b9815196c0e5ae8aee86f8d9029..afb54ea325b35936643e8e90e923a893c1da8fc5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -31,7 +31,7 @@ use Friendica\Util;
 
 class ParseUrl extends BaseModule
 {
-       public static function rawContent(array $parameters = [])
+       protected function rawContent(array $request = [])
        {
                if (!Session::isAuthenticated()) {
                        throw new \Friendica\Network\HTTPException\ForbiddenException();
@@ -94,10 +94,10 @@ class ParseUrl extends BaseModule
                }
 
                if ($format == 'json') {
-                       $type = Util\ParseUrl::getContentType($url);
+                       $siteinfo = Util\ParseUrl::getSiteinfoCached($url);
 
-                       if (in_array($type, ['image', 'video', 'audio'])) {
-                               switch ($type) {
+                       if (in_array($siteinfo['type'], ['image', 'video', 'audio'])) {
+                               switch ($siteinfo['type']) {
                                        case 'video':
                                                $content_type = 'video';
                                                break;
@@ -113,8 +113,6 @@ class ParseUrl extends BaseModule
                                $ret['data'] = ['url' => $url];
                                $ret['success'] = true;
                        } else {
-                               $siteinfo = Util\ParseUrl::getSiteinfoCached($url);
-
                                unset($siteinfo['keywords']);
 
                                $ret['data'] = $siteinfo;