1
0
Fork 0

Stopped using deprecated constants NETWORK_* (#5537)

* Rewrite:
- stopped using deprecated NETWORK_* constants, now Protocol::* should be used
- still left them intact for slow/lazy developers ...

* Removed deprecated NETWORK_* constants as per code reviewer's request.
This commit is contained in:
Roland Häder 2018-08-11 22:40:44 +02:00 committed by Hypolite Petovan
commit e06fc2aa69
59 changed files with 527 additions and 492 deletions

View file

@ -11,6 +11,7 @@ use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -542,7 +543,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
if ($mode === 'community') {
$writable = true;
} else {
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
}
if (!local_user()) {
@ -575,7 +576,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
$sparkle = '';
// prevent private email from leaking.
if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) {
continue;
}
@ -713,7 +714,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
builtin_activity_puller($item, $conv_responses);
// Only add what is visible
if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
if ($item['network'] === Protocol::MAIL && local_user() != $item['uid']) {
continue;
}
@ -793,7 +794,7 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid)
foreach ($items as $index => $item) {
if ($item['uid'] == 0) {
$items[$index]['writable'] = in_array($item['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
$items[$index]['writable'] = in_array($item['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
}
}
@ -842,7 +843,7 @@ function item_photo_menu($item) {
$contact_url = 'contacts/' . $cid;
$posts_link = 'contacts/' . $cid . '/posts';
if (in_array($network, [NETWORK_DFRN, NETWORK_DIASPORA])) {
if (in_array($network, [Protocol::DFRN, Protocol::DIASPORA])) {
$pm_url = 'message/new/' . $cid;
}
}
@ -858,12 +859,12 @@ function item_photo_menu($item) {
L10n::t('Send PM') => $pm_url
];
if ($network == NETWORK_DFRN) {
if ($network == Protocol::DFRN) {
$menu[L10n::t("Poke")] = $poke_link;
}
if ((($cid == 0) || ($rel == Contact::FOLLOWER)) &&
in_array($item['network'], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA])) {
in_array($item['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
$menu[L10n::t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
}
} else {