mirror of
https://github.com/friendica/friendica
synced 2025-04-25 02:30:11 +00:00
[WIP] Rewrite to Proxy class: (#5507)
* Rewrite to Proxy class: - introduced new Friendica\Network\Proxy class for in exchange of proxy_*() functions - moved also all PROXY_* constants there as Proxy::* - removed now no longer needed mod/proxy.php loading as composer's auto-load will do this for us - renamed those proxy_*() functions to better names: + proxy_init() -> Proxy::init() (public) + proxy_url() -> Proxy::proxifyUrl() (public) + proxy_parse_html() -> Proxy::proxifyHtml() (public) + proxy_is_local_image() -> Proxy::isLocalImage() (private) + proxy_parse_query() -> Proxy::parseQuery() (private) + proxy_img_cb() -> Proxy::replaceUrl() (private) * Ops, need to set $a here ... * CR request: - moved Proxy class to Friendica\Module - extended BaseModule * Ops, no need for own instance of $a when self::getApp() is around. * Proxy-rewrite: - proxy_url() and proxy_parse_html() are both non-module functions (now methods) - so they must be splitted into a seperate class - also the SIZE_* and DEFAULT_TIME constants are both not relevant to module * No instances from utility classes * Fixed error: - proxify*() is now located in `Friendica\Util\ProxyUtils` * Moved back to original place, ops? How did they move here? Well, it was not intended by me. * Removed duplicate (left-over from split) constants and static array. Thank to MrPetovan finding it. * Renamed ProxyUtils -> Proxy and aliased it back to ProxyUtils.
This commit is contained in:
parent
bf87ad4fcf
commit
4d39164c1e
30 changed files with 578 additions and 448 deletions
|
@ -24,10 +24,9 @@ use Friendica\Object\Image;
|
|||
use Friendica\Util\Map;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use League\HTMLToMarkdown\HtmlConverter;
|
||||
|
||||
require_once "mod/proxy.php";
|
||||
|
||||
class BBCode extends BaseObject
|
||||
{
|
||||
/**
|
||||
|
@ -361,7 +360,7 @@ class BBCode extends BaseObject
|
|||
{
|
||||
// Only send proxied pictures to API and for internal display
|
||||
if (in_array($simplehtml, [false, 2])) {
|
||||
return proxy_url($image);
|
||||
return ProxyUtils::proxifyUrl($image);
|
||||
} else {
|
||||
return $image;
|
||||
}
|
||||
|
@ -1033,7 +1032,7 @@ class BBCode extends BaseObject
|
|||
} else {
|
||||
$text = trim($share[1]) . "\n";
|
||||
|
||||
$avatar = proxy_url($avatar, false, PROXY_SIZE_THUMB);
|
||||
$avatar = ProxyUtils::proxifyUrl($avatar, false, ProxyUtils::SIZE_THUMB);
|
||||
|
||||
$tpl = get_markup_template('shared_content.tpl');
|
||||
$text .= replace_macros($tpl, [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue