Merge pull request #10835 from annando/proxyutils
Unneeded "ProxyUtils" renamed to "Proxy"
This commit is contained in:
commit
e1bd8fdba0
|
@ -35,7 +35,7 @@ use Friendica\DI;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\ParseUrl;
|
use Friendica\Util\ParseUrl;
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -236,14 +236,14 @@ class OEmbed
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "photo":
|
case "photo":
|
||||||
$ret .= '<img width="' . $oembed->width . '" src="' . ProxyUtils::proxifyUrl($oembed->url) . '">';
|
$ret .= '<img width="' . $oembed->width . '" src="' . Proxy::proxifyUrl($oembed->url) . '">';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "link":
|
case "link":
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "rich":
|
case "rich":
|
||||||
$ret .= ProxyUtils::proxifyHtml($oembed->html);
|
$ret .= Proxy::proxifyHtml($oembed->html);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ use Friendica\Protocol\Activity;
|
||||||
use Friendica\Util\Images;
|
use Friendica\Util\Images;
|
||||||
use Friendica\Util\Map;
|
use Friendica\Util\Map;
|
||||||
use Friendica\Util\ParseUrl;
|
use Friendica\Util\ParseUrl;
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ class BBCode
|
||||||
} elseif ($uriid > 0) {
|
} elseif ($uriid > 0) {
|
||||||
return Post\Link::getByLink($uriid, $image, $size);
|
return Post\Link::getByLink($uriid, $image, $size);
|
||||||
} else {
|
} else {
|
||||||
return ProxyUtils::proxifyUrl($image, $size);
|
return Proxy::proxifyUrl($image, $size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1059,9 +1059,9 @@ class BBCode
|
||||||
$attributes['profile'] = ($author_contact['url'] ?? '') ?: $attributes['profile'];
|
$attributes['profile'] = ($author_contact['url'] ?? '') ?: $attributes['profile'];
|
||||||
|
|
||||||
if (!empty($author_contact['id'])) {
|
if (!empty($author_contact['id'])) {
|
||||||
$attributes['avatar'] = Contact::getAvatarUrlForId($author_contact['id'], ProxyUtils::SIZE_THUMB);
|
$attributes['avatar'] = Contact::getAvatarUrlForId($author_contact['id'], Proxy::SIZE_THUMB);
|
||||||
} elseif ($attributes['avatar']) {
|
} elseif ($attributes['avatar']) {
|
||||||
$attributes['avatar'] = self::proxyUrl($attributes['avatar'], self::INTERNAL, $uriid, ProxyUtils::SIZE_THUMB);
|
$attributes['avatar'] = self::proxyUrl($attributes['avatar'], self::INTERNAL, $uriid, Proxy::SIZE_THUMB);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = preg_replace(Strings::autoLinkRegEx(), '<a href="$1">$1</a>', $match[3]);
|
$content = preg_replace(Strings::autoLinkRegEx(), '<a href="$1">$1</a>', $match[3]);
|
||||||
|
|
|
@ -1722,7 +1722,7 @@ class Contact
|
||||||
* Get avatar link for given contact id
|
* Get avatar link for given contact id
|
||||||
*
|
*
|
||||||
* @param integer $cid contact id
|
* @param integer $cid contact id
|
||||||
* @param string $size One of the ProxyUtils::SIZE_* constants
|
* @param string $size One of the Proxy::SIZE_* constants
|
||||||
* @param string $updated Contact update date
|
* @param string $updated Contact update date
|
||||||
* @return string avatar link
|
* @return string avatar link
|
||||||
*/
|
*/
|
||||||
|
@ -1764,7 +1764,7 @@ class Contact
|
||||||
*
|
*
|
||||||
* @param string $url contact url
|
* @param string $url contact url
|
||||||
* @param integer $uid user id
|
* @param integer $uid user id
|
||||||
* @param string $size One of the ProxyUtils::SIZE_* constants
|
* @param string $size One of the Proxy::SIZE_* constants
|
||||||
* @return string avatar link
|
* @return string avatar link
|
||||||
*/
|
*/
|
||||||
public static function getAvatarUrlForUrl(string $url, int $uid, string $size = ''):string
|
public static function getAvatarUrlForUrl(string $url, int $uid, string $size = ''):string
|
||||||
|
@ -1779,7 +1779,7 @@ class Contact
|
||||||
* Get header link for given contact id
|
* Get header link for given contact id
|
||||||
*
|
*
|
||||||
* @param integer $cid contact id
|
* @param integer $cid contact id
|
||||||
* @param string $size One of the ProxyUtils::SIZE_* constants
|
* @param string $size One of the Proxy::SIZE_* constants
|
||||||
* @param string $updated Contact update date
|
* @param string $updated Contact update date
|
||||||
* @return string header link
|
* @return string header link
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -686,7 +686,7 @@ class Media
|
||||||
* Get preview link for given media id
|
* Get preview link for given media id
|
||||||
*
|
*
|
||||||
* @param integer $id media id
|
* @param integer $id media id
|
||||||
* @param string $size One of the ProxyUtils::SIZE_* constants
|
* @param string $size One of the Proxy::SIZE_* constants
|
||||||
* @return string preview link
|
* @return string preview link
|
||||||
*/
|
*/
|
||||||
public static function getPreviewUrlForId(int $id, string $size = ''):string
|
public static function getPreviewUrlForId(int $id, string $size = ''):string
|
||||||
|
@ -716,7 +716,7 @@ class Media
|
||||||
* Get media link for given media id
|
* Get media link for given media id
|
||||||
*
|
*
|
||||||
* @param integer $id media id
|
* @param integer $id media id
|
||||||
* @param string $size One of the ProxyUtils::SIZE_* constants
|
* @param string $size One of the Proxy::SIZE_* constants
|
||||||
* @return string media link
|
* @return string media link
|
||||||
*/
|
*/
|
||||||
public static function getUrlForId(int $id, string $size = ''):string
|
public static function getUrlForId(int $id, string $size = ''):string
|
||||||
|
|
|
@ -41,7 +41,7 @@ use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\HTTPSignature;
|
use Friendica\Util\HTTPSignature;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
class Profile
|
class Profile
|
||||||
|
@ -441,7 +441,7 @@ class Profile
|
||||||
$p['address'] = BBCode::convertForUriId($profile['uri-id'] ?? 0, $p['address']);
|
$p['address'] = BBCode::convertForUriId($profile['uri-id'] ?? 0, $p['address']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$p['photo'] = Contact::getAvatarUrlForId($cid, ProxyUtils::SIZE_SMALL);
|
$p['photo'] = Contact::getAvatarUrlForId($cid, Proxy::SIZE_SMALL);
|
||||||
|
|
||||||
$p['url'] = Contact::magicLinkById($cid, $profile['url']);
|
$p['url'] = Contact::magicLinkById($cid, $profile['url']);
|
||||||
|
|
||||||
|
|
|
@ -844,7 +844,7 @@ class User
|
||||||
* Get avatar link for given user
|
* Get avatar link for given user
|
||||||
*
|
*
|
||||||
* @param array $user
|
* @param array $user
|
||||||
* @param string $size One of the ProxyUtils::SIZE_* constants
|
* @param string $size One of the Proxy::SIZE_* constants
|
||||||
* @return string avatar link
|
* @return string avatar link
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -42,7 +42,7 @@ use Friendica\Network\HTTPClientOptions;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Images;
|
use Friendica\Util\Images;
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy;
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
|
@ -1193,7 +1193,7 @@ class OStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is it a remote picture? Then make a smaller preview here
|
// Is it a remote picture? Then make a smaller preview here
|
||||||
$preview = Post\Link::getByLink($uriid, $preview, ProxyUtils::SIZE_SMALL);
|
$preview = Post\Link::getByLink($uriid, $preview, Proxy::SIZE_SMALL);
|
||||||
|
|
||||||
// Is it a local picture? Then make it smaller here
|
// Is it a local picture? Then make it smaller here
|
||||||
$preview = str_replace(["-0.jpg", "-0.png"], ["-2.jpg", "-2.png"], $preview);
|
$preview = str_replace(["-0.jpg", "-0.png"], ["-2.jpg", "-2.png"], $preview);
|
||||||
|
@ -1258,7 +1258,7 @@ class OStatus
|
||||||
XML::addElement($doc, $root, "id", DI::baseUrl() . "/profile/" . $owner["nick"]);
|
XML::addElement($doc, $root, "id", DI::baseUrl() . "/profile/" . $owner["nick"]);
|
||||||
XML::addElement($doc, $root, "title", $title);
|
XML::addElement($doc, $root, "title", $title);
|
||||||
XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], DI::config()->get('config', 'sitename')));
|
XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], DI::config()->get('config', 'sitename')));
|
||||||
XML::addElement($doc, $root, "logo", User::getAvatarUrl($owner, ProxyUtils::SIZE_SMALL));
|
XML::addElement($doc, $root, "logo", User::getAvatarUrl($owner, Proxy::SIZE_SMALL));
|
||||||
XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM));
|
XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM));
|
||||||
|
|
||||||
$author = self::addAuthor($doc, $owner, true);
|
$author = self::addAuthor($doc, $owner, true);
|
||||||
|
@ -1413,18 +1413,18 @@ class OStatus
|
||||||
$attributes = [
|
$attributes = [
|
||||||
"rel" => "avatar",
|
"rel" => "avatar",
|
||||||
"type" => "image/jpeg", // To-Do?
|
"type" => "image/jpeg", // To-Do?
|
||||||
"media:width" => ProxyUtils::PIXEL_SMALL,
|
"media:width" => Proxy::PIXEL_SMALL,
|
||||||
"media:height" => ProxyUtils::PIXEL_SMALL,
|
"media:height" => Proxy::PIXEL_SMALL,
|
||||||
"href" => User::getAvatarUrl($owner, ProxyUtils::SIZE_SMALL)];
|
"href" => User::getAvatarUrl($owner, Proxy::SIZE_SMALL)];
|
||||||
XML::addElement($doc, $author, "link", "", $attributes);
|
XML::addElement($doc, $author, "link", "", $attributes);
|
||||||
|
|
||||||
if (isset($owner["thumb"])) {
|
if (isset($owner["thumb"])) {
|
||||||
$attributes = [
|
$attributes = [
|
||||||
"rel" => "avatar",
|
"rel" => "avatar",
|
||||||
"type" => "image/jpeg", // To-Do?
|
"type" => "image/jpeg", // To-Do?
|
||||||
"media:width" => ProxyUtils::PIXEL_THUMB,
|
"media:width" => Proxy::PIXEL_THUMB,
|
||||||
"media:height" => ProxyUtils::PIXEL_THUMB,
|
"media:height" => Proxy::PIXEL_THUMB,
|
||||||
"href" => User::getAvatarUrl($owner, ProxyUtils::SIZE_THUMB)];
|
"href" => User::getAvatarUrl($owner, Proxy::SIZE_THUMB)];
|
||||||
XML::addElement($doc, $author, "link", "", $attributes);
|
XML::addElement($doc, $author, "link", "", $attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ class Proxy
|
||||||
* provided URL isn't local
|
* provided URL isn't local
|
||||||
*
|
*
|
||||||
* @param string $url The URL to proxyfy
|
* @param string $url The URL to proxyfy
|
||||||
* @param string $size One of the ProxyUtils::SIZE_* constants
|
* @param string $size One of the Proxy::SIZE_* constants
|
||||||
*
|
*
|
||||||
* @return string The proxyfied URL or relative path
|
* @return string The proxyfied URL or relative path
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
|
|
|
@ -23,8 +23,6 @@ namespace Friendica\Worker;
|
||||||
|
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Photo;
|
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear cache entries
|
* Clear cache entries
|
||||||
|
|
Loading…
Reference in a new issue