[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:
committed by
Hypolite Petovan
parent
bf87ad4fcf
commit
4d39164c1e
@@ -14,6 +14,7 @@ use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Mail;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/conversation.php';
|
||||
@@ -388,7 +389,7 @@ function message_content(App $a)
|
||||
'from_url' => $from_url,
|
||||
'from_addr' => $contact['addr'],
|
||||
'sparkle' => $sparkle,
|
||||
'from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB),
|
||||
'from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB),
|
||||
'subject' => $subject_e,
|
||||
'body' => $body_e,
|
||||
'delete' => L10n::t('Delete message'),
|
||||
@@ -489,7 +490,7 @@ function render_messages(array $msg, $t)
|
||||
'$from_url' => Contact::magicLink($rr['url']),
|
||||
'$from_addr' => $contact['addr'],
|
||||
'$sparkle' => ' sparkle',
|
||||
'$from_photo' => proxy_url($from_photo, false, PROXY_SIZE_THUMB),
|
||||
'$from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB),
|
||||
'$subject' => $subject_e,
|
||||
'$delete' => L10n::t('Delete conversation'),
|
||||
'$body' => $body_e,
|
||||
|
||||
Reference in New Issue
Block a user