<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
class ParseUrl extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ protected function rawContent(array $request = [])
{
if (!Session::isAuthenticated()) {
throw new \Friendica\Network\HTTPException\ForbiddenException();
if ($format == 'json') {
System::jsonExit($arr['text']);
} else {
- echo $arr['text'];
- exit();
+ System::httpExit($arr['text']);
}
}
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;
$ret['data'] = ['url' => $url];
$ret['success'] = true;
} else {
- $siteinfo = Util\ParseUrl::getSiteinfoCached($url);
-
unset($siteinfo['keywords']);
$ret['data'] = $siteinfo;
System::jsonExit($ret);
} else {
- echo BBCode::embedURL($url, empty($_GET['noAttachment']), $title, $description, $_GET['tags'] ?? '');
- exit();
+ System::httpExit(BBCode::embedURL($url, empty($_GET['noAttachment']), $title, $description, $_GET['tags'] ?? ''));
}
}
}