Renaming functions and class
This commit is contained in:
parent
93ab82b7f0
commit
cdbddd0103
8 changed files with 84 additions and 1212 deletions
|
@ -8,11 +8,10 @@ use Friendica\Content\ContactSelector;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model;\
|
||||
use Friendica\Module\Contact;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Module\Contacts;
|
||||
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
|
@ -42,13 +41,13 @@ function allfriends_content(App $a)
|
|||
}
|
||||
|
||||
$a->page['aside'] = "";
|
||||
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
||||
Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
|
||||
|
||||
$total = GContact::countAllFriends(local_user(), $cid);
|
||||
$total = Model\GContact::countAllFriends(local_user(), $cid);
|
||||
|
||||
$a->setPagerTotal($total);
|
||||
|
||||
$r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||
$r = Model\GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||
if (!DBA::isResult($r)) {
|
||||
$o .= L10n::t('No friends to display.');
|
||||
return $o;
|
||||
|
@ -59,7 +58,7 @@ function allfriends_content(App $a)
|
|||
$entries = [];
|
||||
foreach ($r as $rr) {
|
||||
//get further details of the contact
|
||||
$contact_details = Contact::getDetailsByURL($rr['url'], $uid, $rr);
|
||||
$contact_details = Model\Contact::getDetailsByURL($rr['url'], $uid, $rr);
|
||||
|
||||
$photo_menu = '';
|
||||
|
||||
|
@ -68,11 +67,11 @@ function allfriends_content(App $a)
|
|||
// If the contact is not common to the user, Connect/Follow' will be added to the photo menu
|
||||
if ($rr['cid']) {
|
||||
$rr['id'] = $rr['cid'];
|
||||
$photo_menu = Contact::photoMenu($rr);
|
||||
$photo_menu = Model\Contact::photoMenu($rr);
|
||||
} else {
|
||||
$connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
|
||||
$photo_menu = [
|
||||
'profile' => [L10n::t("View Profile"), Contact::magicLink($rr['url'])],
|
||||
'profile' => [L10n::t("View Profile"), Model\Contact::magicLink($rr['url'])],
|
||||
'follow' => [L10n::t("Connect/Follow"), $connlnk]
|
||||
];
|
||||
}
|
||||
|
@ -86,7 +85,7 @@ function allfriends_content(App $a)
|
|||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
'account_type' => Contact::getAccountType($contact_details),
|
||||
'account_type' => Model\Contact::getAccountType($contact_details),
|
||||
'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
|
||||
'photo_menu' => $photo_menu,
|
||||
'conntxt' => L10n::t('Connect'),
|
||||
|
@ -96,7 +95,7 @@ function allfriends_content(App $a)
|
|||
$entries[] = $entry;
|
||||
}
|
||||
|
||||
$tab_str = Contacts::contacts_tab($a, $contact, 4);
|
||||
$tab_str = Contact::getTabsHTML($a, $contact, 4);
|
||||
|
||||
$tpl = get_markup_template('viewcontact_template.tpl');
|
||||
|
||||
|
|
|
@ -7,11 +7,10 @@ use Friendica\App;
|
|||
use Friendica\Content\ContactSelector;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Contact;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Module\Contacts;
|
||||
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
||||
|
@ -42,7 +41,7 @@ function common_content(App $a)
|
|||
|
||||
if (DBA::isResult($contact)) {
|
||||
$a->page['aside'] = "";
|
||||
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
||||
Model\Profile::load($a, "", 0,Model\Contact::getDetailsByURL($contact["url"]));
|
||||
}
|
||||
} else {
|
||||
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]);
|
||||
|
@ -65,12 +64,12 @@ function common_content(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!$cid && Profile::getMyURL()) {
|
||||
$contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $uid]);
|
||||
if (!$cid &&Model\Profile::getMyURL()) {
|
||||
$contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Model\Profile::getMyURL()), 'uid' => $uid]);
|
||||
if (DBA::isResult($contact)) {
|
||||
$cid = $contact['id'];
|
||||
} else {
|
||||
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
|
||||
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Model\Profile::getMyURL())]);
|
||||
if (DBA::isResult($gcontact)) {
|
||||
$zcid = $gcontact['id'];
|
||||
}
|
||||
|
@ -82,9 +81,9 @@ function common_content(App $a)
|
|||
}
|
||||
|
||||
if ($cid) {
|
||||
$t = GContact::countCommonFriends($uid, $cid);
|
||||
$t =Model\GContact::countCommonFriends($uid, $cid);
|
||||
} else {
|
||||
$t = GContact::countCommonFriendsZcid($uid, $zcid);
|
||||
$t =Model\GContact::countCommonFriendsZcid($uid, $zcid);
|
||||
}
|
||||
|
||||
if ($t > 0) {
|
||||
|
@ -95,9 +94,9 @@ function common_content(App $a)
|
|||
}
|
||||
|
||||
if ($cid) {
|
||||
$r = GContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||
$r =Model\GContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||
} else {
|
||||
$r = GContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
|
||||
$r =Model\GContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
|
||||
}
|
||||
|
||||
if (!DBA::isResult($r)) {
|
||||
|
@ -109,13 +108,13 @@ function common_content(App $a)
|
|||
$entries = [];
|
||||
foreach ($r as $rr) {
|
||||
//get further details of the contact
|
||||
$contact_details = Contact::getDetailsByURL($rr['url'], $uid);
|
||||
$contact_details =Model\Contact::getDetailsByURL($rr['url'], $uid);
|
||||
|
||||
// $rr['id'] is needed to use contact_photo_menu()
|
||||
/// @TODO Adding '/" here avoids E_NOTICE on missing constants
|
||||
$rr['id'] = $rr['cid'];
|
||||
|
||||
$photo_menu = Contact::photoMenu($rr);
|
||||
$photo_menu =Model\Contact::photoMenu($rr);
|
||||
|
||||
$entry = [
|
||||
'url' => $rr['url'],
|
||||
|
@ -126,7 +125,7 @@ function common_content(App $a)
|
|||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
'account_type' => Contact::getAccountType($contact_details),
|
||||
'account_type' =>Model\Contact::getAccountType($contact_details),
|
||||
'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
|
||||
'photo_menu' => $photo_menu,
|
||||
'id' => ++$id,
|
||||
|
@ -137,7 +136,7 @@ function common_content(App $a)
|
|||
$title = '';
|
||||
$tab_str = '';
|
||||
if ($cmd === 'loc' && $cid && local_user() == $uid) {
|
||||
$tab_str = Contacts::contacts_tab($a, $contact, 4);
|
||||
$tab_str = Contact::getTabsHTML($a, $contact, 4);
|
||||
} else {
|
||||
$title = L10n::t('Common Friends');
|
||||
}
|
||||
|
|
1123
mod/contacts.php
1123
mod/contacts.php
File diff suppressed because it is too large
Load diff
|
@ -8,9 +8,8 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Module\Contacts;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Contact;
|
||||
|
||||
require_once 'mod/contacts.php';
|
||||
|
||||
|
@ -83,7 +82,7 @@ function crepair_post(App $a)
|
|||
if ($photo) {
|
||||
logger('mod-crepair: updating photo from ' . $photo);
|
||||
|
||||
Contact::updateAvatar($photo, local_user(), $contact['id']);
|
||||
Model\Contact::updateAvatar($photo, local_user(), $contact['id']);
|
||||
}
|
||||
|
||||
if ($r) {
|
||||
|
@ -136,7 +135,7 @@ function crepair_content(App $a)
|
|||
|
||||
$update_profile = in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]);
|
||||
|
||||
$tab_str = Contacts::contacts_tab($a, $contact, 5);
|
||||
$tab_str = Contact::getTabsHTML($a, $contact, 5);
|
||||
|
||||
$tpl = get_markup_template('crepair.tpl');
|
||||
$o = replace_macros($tpl, [
|
||||
|
|
|
@ -12,13 +12,13 @@ use Friendica\Core\Protocol;
|
|||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\GContact;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Contact;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Module\Contacts;
|
||||
|
||||
|
||||
function dirfind_init(App $a) {
|
||||
|
||||
|
@ -82,7 +82,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
$objresult->tags = "";
|
||||
$objresult->network = $user_data["network"];
|
||||
|
||||
$contact = Contact::getDetailsByURL($user_data["url"], local_user());
|
||||
$contact = Model\Contact::getDetailsByURL($user_data["url"], local_user());
|
||||
$objresult->cid = $contact["cid"];
|
||||
$objresult->pcid = $contact["zid"];
|
||||
|
||||
|
@ -90,7 +90,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
|
||||
// Add the contact to the global contacts if it isn't already in our system
|
||||
if (($contact["cid"] == 0) && ($contact["zid"] == 0) && ($contact["gid"] == 0)) {
|
||||
GContact::update($user_data);
|
||||
Model\GContact::update($user_data);
|
||||
}
|
||||
} elseif ($local) {
|
||||
|
||||
|
@ -155,7 +155,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
continue;
|
||||
}
|
||||
|
||||
$result = Contact::getDetailsByURL($result["nurl"], local_user());
|
||||
$result = Model\Contact::getDetailsByURL($result["nurl"], local_user());
|
||||
|
||||
if ($result["name"] == "") {
|
||||
$result["name"] = end(explode("/", $urlparts["path"]));
|
||||
|
@ -199,7 +199,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
|
||||
$alt_text = "";
|
||||
|
||||
$contact_details = Contact::getDetailsByURL($jj->url, local_user());
|
||||
$contact_details = Model\Contact::getDetailsByURL($jj->url, local_user());
|
||||
|
||||
$itemurl = (($contact_details["addr"] != "") ? $contact_details["addr"] : $jj->url);
|
||||
|
||||
|
@ -209,8 +209,8 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
$conntxt = "";
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
|
||||
if (DBA::isResult($contact)) {
|
||||
$photo_menu = Contact::photoMenu($contact);
|
||||
$details = Contacts::_contact_detail_for_template($contact);
|
||||
$photo_menu =Model\Contact::photoMenu($contact);
|
||||
$details = Contact::getContactTemplateVars($contact);
|
||||
$alt_text = $details['alt_text'];
|
||||
} else {
|
||||
$photo_menu = [];
|
||||
|
@ -221,7 +221,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
|
||||
$contact = DBA::selectFirst('contact', [], ['id' => $jj->pcid]);
|
||||
if (DBA::isResult($contact)) {
|
||||
$photo_menu = Contact::photoMenu($contact);
|
||||
$photo_menu = Model\Contact::photoMenu($contact);
|
||||
} else {
|
||||
$photo_menu = [];
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
|
||||
$entry = [
|
||||
'alt_text' => $alt_text,
|
||||
'url' => Contact::magicLink($jj->url),
|
||||
'url' => Model\Contact::magicLink($jj->url),
|
||||
'itemurl' => $itemurl,
|
||||
'name' => htmlentities($jj->name),
|
||||
'thumb' => ProxyUtils::proxifyUrl($jj->photo, false, ProxyUtils::SIZE_THUMB),
|
||||
|
@ -245,7 +245,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
'details' => $contact_details['location'],
|
||||
'tags' => $contact_details['keywords'],
|
||||
'about' => $contact_details['about'],
|
||||
'account_type' => Contact::getAccountType($contact_details),
|
||||
'account_type' => Model\Contact::getAccountType($contact_details),
|
||||
'network' => ContactSelector::networkToName($jj->network, $jj->url),
|
||||
'id' => ++$id,
|
||||
];
|
||||
|
|
|
@ -11,9 +11,8 @@ use Friendica\Core\L10n;
|
|||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Group;
|
||||
use Friendica\Module\Contacts;
|
||||
use Friendica\Model;
|
||||
use Friendica\Module\Contact;
|
||||
|
||||
function group_init(App $a) {
|
||||
if (local_user()) {
|
||||
|
@ -186,7 +185,7 @@ function group_content(App $a) {
|
|||
}
|
||||
|
||||
$group = $r[0];
|
||||
$members = Contact::getByGroupId($group['id']);
|
||||
$members = Model\Contact::getByGroupId($group['id']);
|
||||
$preselected = [];
|
||||
$entry = [];
|
||||
$id = 0;
|
||||
|
@ -204,7 +203,7 @@ function group_content(App $a) {
|
|||
Group::addMember($group['id'], $change);
|
||||
}
|
||||
|
||||
$members = Contact::getByGroupId($group['id']);
|
||||
$members = Model\Contact::getByGroupId($group['id']);
|
||||
$preselected = [];
|
||||
if (count($members)) {
|
||||
foreach ($members as $member) {
|
||||
|
@ -250,7 +249,7 @@ function group_content(App $a) {
|
|||
// Format the data of the group members
|
||||
foreach ($members as $member) {
|
||||
if ($member['url']) {
|
||||
$entry = Contacts::_contact_detail_for_template($member);
|
||||
$entry = Contact::getContactTemplateVars($member);
|
||||
$entry['label'] = 'members';
|
||||
$entry['photo_menu'] = '';
|
||||
$entry['change_member'] = [
|
||||
|
@ -267,7 +266,7 @@ function group_content(App $a) {
|
|||
}
|
||||
|
||||
if ($nogroup) {
|
||||
$r = Contact::getUngroupedList(local_user());
|
||||
$r = Model\Contact::getUngroupedList(local_user());
|
||||
} else {
|
||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `self` ORDER BY `name` ASC",
|
||||
intval(local_user())
|
||||
|
@ -279,7 +278,7 @@ function group_content(App $a) {
|
|||
// Format the data of the contacts who aren't in the contact group
|
||||
foreach ($r as $member) {
|
||||
if (!in_array($member['id'], $preselected)) {
|
||||
$entry = Contacts::_contact_detail_for_template($member);
|
||||
$entry = Contact::getContactTemplateVars($member);
|
||||
$entry['label'] = 'contacts';
|
||||
if (!$nogroup)
|
||||
$entry['photo_menu'] = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue