mirror of
https://github.com/friendica/friendica
synced 2025-04-25 06: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
|
@ -16,6 +16,7 @@ use Friendica\Model\Contact;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Term;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -112,8 +113,6 @@ class Post extends BaseObject
|
|||
*/
|
||||
public function getTemplateData($conv_responses, $thread_level = 1)
|
||||
{
|
||||
require_once "mod/proxy.php";
|
||||
|
||||
$result = [];
|
||||
|
||||
$a = self::getApp();
|
||||
|
@ -150,6 +149,7 @@ class Post extends BaseObject
|
|||
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
|
||||
? L10n::t('Private Message')
|
||||
: false);
|
||||
|
||||
$shareable = in_array($conv->getProfileOwner(), [0, local_user()]) && $item['private'] != 1;
|
||||
|
||||
if (local_user() && link_compare($a->contact['url'], $item['author-link'])) {
|
||||
|
@ -367,7 +367,7 @@ class Post extends BaseObject
|
|||
'profile_url' => $profile_link,
|
||||
'item_photo_menu' => item_photo_menu($item),
|
||||
'name' => $name_e,
|
||||
'thumb' => $a->remove_baseurl(proxy_url($item['author-avatar'], false, PROXY_SIZE_THUMB)),
|
||||
'thumb' => $a->remove_baseurl(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)),
|
||||
'osparkle' => $osparkle,
|
||||
'sparkle' => $sparkle,
|
||||
'title' => $title_e,
|
||||
|
@ -380,7 +380,7 @@ class Post extends BaseObject
|
|||
'indent' => $indent,
|
||||
'shiny' => $shiny,
|
||||
'owner_url' => $this->getOwnerUrl(),
|
||||
'owner_photo' => $a->remove_baseurl(proxy_url($item['owner-avatar'], false, PROXY_SIZE_THUMB)),
|
||||
'owner_photo' => $a->remove_baseurl(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
|
||||
'owner_name' => htmlentities($owner_name_e),
|
||||
'plink' => get_plink($item),
|
||||
'edpost' => Feature::isEnabled($conv->getProfileOwner(), 'edit_posts') ? $edpost : '',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue