From a0cdd9c67446b8e7a5a81e64e72478310a235d65 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 5 Feb 2018 12:57:41 -0500 Subject: [PATCH] Rename Core\Network to Core\Protocol --- boot.php | 46 +++++++++++++------------- include/acl_selectors.php | 8 ++--- mod/display.php | 4 +-- src/Content/Text/BBCode.php | 10 +++--- src/Core/{Network.php => Protocol.php} | 10 +++--- 5 files changed, 38 insertions(+), 40 deletions(-) rename src/Core/{Network.php => Protocol.php} (91%) diff --git a/boot.php b/boot.php index c996d06e3..a553698e5 100644 --- a/boot.php +++ b/boot.php @@ -23,7 +23,7 @@ use Friendica\App; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Core\Network; +use Friendica\Core\Protocol; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Core\Worker; @@ -249,33 +249,33 @@ define('PROTOCOL_SPLITTED_CONV', 6); */ /** - * @name Network + * @name Network constants * @deprecated since version 3.6 - * @see Friendica\Core\Network + * @see Friendica\Core\Protocol * * Network and protocol family types * @{ */ -define('NETWORK_DFRN' , Network::DFRN); // Friendica, Mistpark, other DFRN implementations -define('NETWORK_ZOT' , Network::ZOT); // Zot! - Currently unsupported -define('NETWORK_OSTATUS' , Network::OSTATUS); // GNU-social, Pleroma, Mastodon, other OStatus implementations -define('NETWORK_FEED' , Network::FEED); // RSS/Atom feeds with no known "post/notify" protocol -define('NETWORK_DIASPORA' , Network::DIASPORA); // Diaspora -define('NETWORK_MAIL' , Network::MAIL); // IMAP/POP -define('NETWORK_FACEBOOK' , Network::FACEBOOK); // Facebook API -define('NETWORK_LINKEDIN' , Network::LINKEDIN); // LinkedIn -define('NETWORK_XMPP' , Network::XMPP); // XMPP - Currently unsupported -define('NETWORK_MYSPACE' , Network::MYSPACE); // MySpace - Currently unsupported -define('NETWORK_GPLUS' , Network::GPLUS); // Google+ -define('NETWORK_PUMPIO' , Network::PUMPIO); // pump.io -define('NETWORK_TWITTER' , Network::TWITTER); // Twitter -define('NETWORK_DIASPORA2', Network::DIASPORA2); // Diaspora connector -define('NETWORK_STATUSNET', Network::STATUSNET); // Statusnet connector -define('NETWORK_APPNET' , Network::APPNET); // app.net - Dead protocol -define('NETWORK_NEWS' , Network::NEWS); // Network News Transfer Protocol - Currently unsupported -define('NETWORK_ICALENDAR', Network::ICALENDAR); // iCalendar - Currently unsupported -define('NETWORK_PNUT' , Network::PNUT); // pnut.io - Currently unsupported -define('NETWORK_PHANTOM' , Network::PHANTOM); // Place holder +define('NETWORK_DFRN' , Protocol::DFRN); // Friendica, Mistpark, other DFRN implementations +define('NETWORK_ZOT' , Protocol::ZOT); // Zot! - Currently unsupported +define('NETWORK_OSTATUS' , Protocol::OSTATUS); // GNU-social, Pleroma, Mastodon, other OStatus implementations +define('NETWORK_FEED' , Protocol::FEED); // RSS/Atom feeds with no known "post/notify" protocol +define('NETWORK_DIASPORA' , Protocol::DIASPORA); // Diaspora +define('NETWORK_MAIL' , Protocol::MAIL); // IMAP/POP +define('NETWORK_FACEBOOK' , Protocol::FACEBOOK); // Facebook API +define('NETWORK_LINKEDIN' , Protocol::LINKEDIN); // LinkedIn +define('NETWORK_XMPP' , Protocol::XMPP); // XMPP - Currently unsupported +define('NETWORK_MYSPACE' , Protocol::MYSPACE); // MySpace - Currently unsupported +define('NETWORK_GPLUS' , Protocol::GPLUS); // Google+ +define('NETWORK_PUMPIO' , Protocol::PUMPIO); // pump.io +define('NETWORK_TWITTER' , Protocol::TWITTER); // Twitter +define('NETWORK_DIASPORA2', Protocol::DIASPORA2); // Diaspora connector +define('NETWORK_STATUSNET', Protocol::STATUSNET); // Statusnet connector +define('NETWORK_APPNET' , Protocol::APPNET); // app.net - Dead protocol +define('NETWORK_NEWS' , Protocol::NEWS); // Network News Transfer Protocol - Currently unsupported +define('NETWORK_ICALENDAR', Protocol::ICALENDAR); // iCalendar - Currently unsupported +define('NETWORK_PNUT' , Protocol::PNUT); // pnut.io - Currently unsupported +define('NETWORK_PHANTOM' , Protocol::PHANTOM); // Place holder /** * @} */ diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 166cf9719..076bb2a49 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -9,11 +9,11 @@ use Friendica\Content\Widget; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Core\Network; +use Friendica\Core\Protocol; use Friendica\Database\DBM; use Friendica\Model\Contact; use Friendica\Model\GContact; -use Friendica\Util\Network as NetworkUtil; +use Friendica\Util\Network; require_once "mod/proxy.php"; @@ -250,7 +250,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p } if ($privmail) { - $trimmed = Network::formatMention($rr['url'], $rr['name']); + $trimmed = Protocol::formatMention($rr['url'], $rr['name']); } else { $trimmed = mb_substr($rr['name'],0,20); } @@ -736,7 +736,7 @@ function navbar_complete(App $a) { if (! $localsearch) { $p = (($a->pager['page'] != 1) ? '&p=' . $a->pager['page'] : ''); - $x = NetworkUtil::curl(get_server() . '/lsearch?f=' . $p . '&search=' . urlencode($search)); + $x = Network::curl(get_server() . '/lsearch?f=' . $p . '&search=' . urlencode($search)); if ($x['success']) { $j = json_decode($x['body'],true); if ($j && isset($j['results'])) { diff --git a/mod/display.php b/mod/display.php index dd6b8b709..eb196b097 100644 --- a/mod/display.php +++ b/mod/display.php @@ -6,7 +6,7 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Core\Network; +use Friendica\Core\Protocol; use Friendica\Core\System; use Friendica\Database\DBM; use Friendica\Model\Contact; @@ -173,7 +173,7 @@ function display_fetchauthor($a, $item) { $profiledata["photo"] = $matches[1]; } $profiledata["nickname"] = $profiledata["name"]; - $profiledata["network"] = Network::matchByProfileUrl($profiledata["url"]); + $profiledata["network"] = Protocol::matchByProfileUrl($profiledata["url"]); $profiledata["address"] = ""; $profiledata["about"] = ""; diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index d68208a60..d2df3cee2 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -13,13 +13,13 @@ use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Core\Network; +use Friendica\Core\Protocol; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Model\Contact; use Friendica\Object\Image; use Friendica\Util\Map; -use Friendica\Util\Network as NetworkUtil; +use Friendica\Util\Network; use Friendica\Util\ParseUrl; require_once "include/bbcode.php"; @@ -521,7 +521,7 @@ class BBCode } else { $scaled = $mtch[1]; } - $i = NetworkUtil::fetchUrl($scaled); + $i = Network::fetchUrl($scaled); if (!$i) { return $srctext; } @@ -1084,13 +1084,13 @@ class BBCode if (x($data, "name") && x($data, "addr")) { $userid_compact = $data["name"] . " (" . $data["addr"] . ")"; } else { - $userid_compact = Network::getAddrFromProfileUrl($profile, $author); + $userid_compact = Protocol::getAddrFromProfileUrl($profile, $author); } if (x($data, "addr")) { $userid = $data["addr"]; } else { - $userid = Network::formatMention($profile, $author); + $userid = Protocol::formatMention($profile, $author); } if (x($data, "name")) { diff --git a/src/Core/Network.php b/src/Core/Protocol.php similarity index 91% rename from src/Core/Network.php rename to src/Core/Protocol.php index 0d59c7e85..9caa0ab15 100644 --- a/src/Core/Network.php +++ b/src/Core/Protocol.php @@ -1,19 +1,17 @@ */ -class Network +class Protocol { const DFRN = 'dfrn'; // Friendica, Mistpark, other DFRN implementations const DIASPORA = 'dspr'; // Diaspora @@ -96,7 +94,7 @@ class Network if (preg_match('=https?://(.*)/user/(.*)=ism', $profile_url, $matches)) { $statusnet_host = $matches[1]; $statusnet_user = $matches[2]; - $UserData = Util\Network::fetchUrl('http://' . $statusnet_host . '/api/users/show.json?user_id=' . $statusnet_user); + $UserData = Network::fetchUrl('http://' . $statusnet_host . '/api/users/show.json?user_id=' . $statusnet_user); $user = json_decode($UserData); if ($user) { $matches[2] = $user->screen_name;